1

I'm looking for the easiest way convert utm to lat / long
If the server-side code is better.

for example utm EASTING NORTHING 521937.7447 3955151.601

Thank you

sali
  • 149
  • 2
  • 8

2 Answers2

3

In order to convert UTM coordinates (easting and northing) to latitude and longitude you need the zone number and zone letter as well. Without these your easting / northing values could be in any of the 60 zones defined by UTM.
As for libraries, there are packages for Python, Javascript and probably others.
Sample for JS:

utm.toLatLon(easting, northing, zoneNum, zoneLetter)
//returns { latitude, longitude }

utm.fromLatLon(latitude, longitude)
//returns { easting, northing, zoneNum, zoneLetter }
Ionut Ticus
  • 2,683
  • 2
  • 17
  • 25
  • For Java you can use geotools or just do the math directly, more details in this [post](https://stackoverflow.com/questions/176137/java-convert-lat-lon-to-utm). – Ionut Ticus Sep 30 '18 at 09:41
2

You can use ST_Transform in Postgis if you have access to this

https://postgis.net/docs/ST_Transform.html

Example:

ST_AsText(ST_Transform(ST_SetSRID(the_geom, 27700), 4326)))
Hutch
  • 411
  • 10
  • 32