0
votes

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

2

2 Answers

2
votes

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)))
1
votes

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 }