Import OpenStreetMap data to Google Maps - ios

Given an OpenStreetMap path (such as this railroad track), is there a simple way to convert the points representing the railroad track from OpenStreetMap to a Google Maps GMSPath?
For example, if it was possible to download all the points (nodes) on the path from OpenStreetMaps and then convert these nodes to Google's Encoded Polyline Algorithm Format, then one could construct a GMSPath with the pathFromEncodedPath initializer.

First - to get the OSM's relation including all ways and nodes, append a "/full" to your relation link using the API; "http://www.openstreetmap.org/api/0.6/relation/1948000/full"
I'm not sure if Verma's solution will work out the box with OpenStreetMap's exported XML. However, a more brute-force way could be to create a script that will parse the XML and iterate over each node element, taking its "lat" and "lon" property, and applying the algorithm described here: https://developers.google.com/maps/documentation/utilities/polylinealgorithm to create an ASCII string that can be read into the Google Maps iOS SDK.

Related

Extracting data from Invoices in pdf or image format

I am working on invoice parser which extracts data from invoices in pdf or image format.It works on simple pdf with non tabular data but gives lots of output data to process with pdf which contains tables.I am not able to get a working generic solution for this.I have tried the following libraries
Invoice2Data : It is based on templates.It has given fairly good results in json format till now.But Template creation for complex pdfs containing dynamic table is complex.
Tabula : Table extraction is based on coordinates of the table to be extracted.If the data in the table increases the table length increases and hence the coordinates changes.So in this case it gives wrong results.
Pdftotext : It converts any pdfs to text but with the format that needs lots of parsing which we do not want.
Aws_Textract and Elis_Rossum_Ai : Gives all the data in json format.But if the table column contains multiple line then json parsing becomes difficult.Even the json given is huge in size to parse.
Tesseract : Same as pdftotext.Complex pdfs are not parseable.
Other than all this or with combination of the above libraries has anyone been able to parse complex pdf data please help.
I am working on a similar business problem. since invoices don't have fixed format so you can't directly use any text parsing method.
To solve this problem you have to use Computer Vision (Deep Learning) for field detection and Pytesseract OCR for converting image into text. For better understanding here are the steps:
Convert invoices to image and annotate the images with fields like address, Amount etc using tools like labelImg. (For better results use different types of 500-1000 invoices)
After Generating XML files train any object detection model like YOLO or TF object detection API.
The model will detect the fields and gives you coordinates of Region Of Interest(ROI). like
Apply Pytessract OCR on the ROI coordinates. Click Here
Finally, use regex to validate the text in the extracted field and perform any manipulation/transformation that is necessary. At last store data to CSV OR Database.
Hope my answer helps you! Upvote answer so it reaches to maximum people.

Map bpmn to wsdl

My task is to take a bpmn 2.0 xml file and map it as good as possible (with a certain error rate) to available web services. For example when my bpmn file explains the process of buying a pizza, i give 10€ and get back 1 pizza. Now it should map that bpmn to the webservice that needs an of type int with the name "money" etc.
How is that even possible? I searched for a few hours now and came up with the following:
I found https://github.com/camunda/camunda-bpm-platform and can easily use it to parse a plain .bpmn file to a java object structure which i can then query. Easy.
After parsing the xml notation i should analyze it and search for elements that input data and elements that output data for this are the only things i can map to wsdl (wsdl only describes the structure of the webservice: names of variables, types of variables, number of variables). Problem: I do not find any 1:1 elements i can easily declare as "when this bpmn element is used, it 100% means that the process is getting some input named x". What should i do here? What can i map?
I found ws-bpel. As far as i understand i can somehow transfer bpmn to ws-bpel which should be better modeling of the process and more easily be mappable to a wsdl (?). Camunda however doesn't offer this functionality and i am restricted to open source software.
Any suggestions what i should do?

XNA 2D windows phone level editor

Can anyone kindly point me in the right direction as to what the best way is to make a 2D Level Editor in XNA for Windows Phone?
I have a game that's almost finished but I wish to create multiple versions of it in the future with different levels and themes etc.
What would be the best way to do this?
I suggest not making one and using something like Tiled instead. It will save stages in a relatively simple XML format, and there's even a C# library to read the Tiled files.
There are plenty of other good editors as well. I recommend going in this direction because quite frankly you will spend way too much time making your own.
To expand further on Tiled, you can use the aforementioned library to parse a TMX file, which are made from using Tiled and saving your map. Read the Usage on the github page, looks pretty simple to use.
When you parse a Tiled element, say a specific tile index or a Tiled "object", you have to map that to something useful in your game (a graphical sprite texture, an enemy or object the player can interact with, etc.). For tiles, you can manage this via enums (create an alias for each tile type and assign it the exact tile number from your tilesheet), or even just an array that follows the same mapping. For objects, use Tiled's object properties to assign meaningful values that you define, which then get saved along with the TMX and you can parse them using that library.
For example, you could define a property in a Tiled object called "enemytype" and give it the value "lizard". The code when parsing could look for this property and value, and create a Lizard object when it's parsed.
If you've got a nearly-finished game, then I'd assume that somewhere in there is code to load and display the map you have. Extract that code and you're halfway there. Then you just need to add some way of adding to the map it's reading from, and save it back to the same format.
If your maps are currently created in memory, then you'll need to figure out a file format you can save them as (XML or JSON works, but a big CSV of ints for tile types works too and is simpler). Then you'll need code to read in from that format and populate your current map model.

How to draw a curve passing through a set of 2D points using Core Plot library for iOS?

Can anyone point me to an example that uses core plot library to draw a curve through N Points as a graph ?
IMPORTANT : I have used core-plot. Unfortunately it just joins your dots with straight lines and not smooth curves.
For achieving this we need to use this method.
the code is in C# to generate control points for a bezier spline.
I converted this code to Objective C and it works brilliantly for me.
http://www.codeproject.com/KB/graphics/BezierSpline.aspx
Make sure that all the arrays used in the code are filled with 'n' NSNull objects as the C# code here uses dynamic arrays where we can put values at any index but same cant be done in Objective C unless we have the existing index in the NSMutableArrays.
Here's the Google Search i did
Here is the Core-Plot's Own example project: Here
And a Third party Tutorial: Here
Also here is a helpful snippet from the Core-Plot Developers: Here
Hope it helps, btw most people on here will prob tell you to use Google for a simple request like this.
So for future reference when you need an example of an API search in google the following "Insert API Name here" Tutorial, This will usually return at least 1 tutorial in most cases on the first page

Converting utm to lat long with different datums (data?)

I'm a GIS novice, but have code to convert lat/long to UTM coordinates, and it assumes the WGS84 datum.
I also have a list of different values for the earth's radius, roundness, etc:
Datum Equatorial Radius (m) Polar Radius (m) Flattening
WGS84 6,378,137 6,356,752.3142 1/298.257223563
Airy 1830 6,377,563.4 6,356,256.9 1/299.32
etc...
Is calculating a different projection as simple as substituting these different constants? I can't find anything that supports or refutes this possibility..
Thanks
There are many online tools to perform this conversion, this one for instance. That tool provides this reference which has an excel spreadsheet including the required formulas. In programming terms, you can use GDAL/OGR and PROJ4 to effect the conversion seamlessly using Python, for example. Any GIS software package will also be able to reproject the data for you without the hassle.
To answer your last question, no, changing the constants is not sufficient to do the conversion. You are correct, however, that the way the conversion is done is datum-dependent.

Resources