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

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.

Related

Signed distance queries between shapes 'Box' and 'Box' are not supported

We tried solving a static equilibrium problem between two boxes:
static_equilibrium_problem = StaticEquilibriumProblem(autodiff_plant, autodiff_plant.GetMyContextFromRoot(autodiff_context), set())
result = Solve(static_equilibrium_problem.prog())
And got this error:
RuntimeError: Signed distance queries between shapes 'Box' and 'Box' are not supported for scalar type drake::AutoDiffXd
Is there more information about why this doesn't work, and how to extend the Static Equilibrium Problem to more general boxes and even meshes?
My guess is the SDF collision query between boxes is not differentiable for some reason, although it works for spheres: https://drake.mit.edu/doxygen_cxx/classdrake_1_1multibody_1_1_static_equilibrium_problem.html
The primary reason is the discontinuity in the derivatives. We haven't decided what we want to do about it. While SDF is continuous, it's gradient isn't inside the box. I'd recommend posting an issue on Drake with your use case, and what kind of results you'd expect given the mathematical properties of SDF for non-smooth geometries (e.g., boxes, general meshes, etc.). The input will help us make decisions and implicitly increase the importance of resolving the known open issue. It may be that you have no problems with the gradient discontinuity.
You'll note this behavior has been documented for the query. However, you'll note for the mathematically related ComputePointPairPenetration() method, we have additional support for AutoDiffXd (as documented here).
But the issue is your best path forward -- we've introduced some of this functionality based on demonstrable need; you seem to have that.

Import OpenStreetMap data to Google Maps

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.

Is double ok for geo-coordinates in Java?

Hi i want to work with geocoordinates in java.
I've defined my Java variables as "double" and my Postgres Database is defined as "double precision".
I've heared of problems with float that 0.1 results sometimes in 0.09999...
It will have to store values like 50.081406 or 8.24481.
The values will be read from an Android-Device.
Do i have to worry about floating-point problems?
The issue with the floats is usually related to addition and subtraction where due to 2's compliment (how they are stored on the computer) they don't always round out exactly to what you want. That being said Doubles are a great way to store lat/lon
Also see: proper/best type for storing latitude and longitude

Matrix language and macro variables

is there a way to use calculations made in matrix language (matrix-end matrix) as macro variables later in calculations?
Let say I calculate chi^2 and pvalue in matrix language and then I want to use them as my new macro variables for, let say, printing information about if the statistics is significant or not.
Of course I can use OMS to solve my problem but I want to find out if there is a possible way to get variables from matrix language to syntax later on.
You might want to look into Python programmability instead of macro. It is much more powerful and flexible. You can read about it in the books and articles section of the SPSS Community website (www.ibm.com/developerworks/spssdevcentral). The site also provides the materials for getting started with programmability.
MATRIX can write datasets, which Python can read and manipulate - and it can even generate macro values from them.
HTH,
Jon Peck

Best practice for determining the probability that 2 strings match

I need to write code to determine if 2 strings match when one of the strings may contain a small deviation from the second string e.g. "South Africa" v "South-Africa" or "England" v "Enlgand". At the moment, I am considering the following approach
Determine the percentage of characters in string 1 that match those in string 2
Determine the true probability of the match by combining the result of 1 with a comparison of the length of the 2 strings e.g. although all the characters in "SA" are found in "South Africa" it is not a very likely match since "SA" could be found in a range of other country names as well.
I would appreciate to hear what current best practice is for performing such string matching.
You can look at Levenshtein distance. This is distance between two strings. The same strings have distance equal 0. Strings such as kitten and sitten have distance equal 1, and so on. Distance is measured by minimal number of simple operations that transform one string to another.
More information and algorithm in pseudo-code is given in link.
I also remember that this topic was mentioned in Game programming gems: volume 6: Article 1.6 Closest-String Matching Algorithm
To make fuzzy string matching ideal, it's important to know about the context of the strings. When it's just about small typos, Levenstein can be good enough. When it's about misheard sound, you can use a phonetic algorithm like soundex or metaphone.
Most times, you need a combination of the following algorithms, and some more specific manually written stuff.
Needleman-Wunsch
Soundex
Metaphone
Levenstein distance
Bitmap
Hamming distance
There is no best fuzzy string matching algorithm. It's all about the context it's used in, so you need to tell us about where you want to use the string matching for.
Don't reinvent the wheel. Wikipedia has the Levenshtein algorithm which has metrics for what you want to do.
http://en.wikipedia.org/wiki/Levenshtein_distance
There's also Soundex, but that might be too simplistic for your requirements.
Use of Soundex proved to work nicely for me:
With a small tweak or two to the implementation, Soundex matching can check cross-languages if two strings of different languages sound the same..
Objective-C Soundex implementation:
http://www.cocoadev.com/index.pl?NSStringSoundex
I've found an Objective-C implementation of the Levenshtein Distance Algorithm here. It works great for me.

Resources