How to convert UTM coordinates to Latitude and Longitude? [duplicate]
-
09-09-2019 - |
Question
Duplicates:
- How do I convert coordinates to a Latitude & Longitude?
- How to convert from UTM to LatLng in python or Javascript2
My current project is interfacing with a central geocoding service published by the local city planning department. The service is designed primarily for surveying, and as such returns coordinates in a UTM X-Y format. My system stores coordinates as decimal latitude and longitude for integration with Google Earth and other mapping tools.
I'd like to come up with an algorithm for converting from X-Y to latitude and longitude for all cases. I have not been able to locate any texts describing the conversion; the most I've been able to find via Google is raw source code in the form of Excel Visual Basic and FORTRAN. I believe a useful general solution would be beneficial to the community at large.
Solution
You need a map projection library to do this.
There are many libraries available that are open source. One of the most complete is PROJ.4.
It is wrapped and used internally by many simpler libraries, such as GDAL.
This will allow you to go from UTM->LatLon (with many options), UTM->State Plane, or from any common projection to any other common projection.
OTHER TIPS
In Java, I would use the OpenMap converter from a point's expression in UTM to one using Latitude and Longitude (assuming a WGS-84 ellipsoid which is most commonly used in GPS).
OpenMap is open source and I would post a link to their download page but they have a short license script in the way. So, to avoid being rude, I won't deep link. Instead, head to their homepage and click Downloads.
That should either solve your problem directly or at least point you towards a useful algorithm.
you could try http://www.gaia-gis.it/spatialite/