Is there a way to convert UTM to Lat/Long in Javascript? I have seen another thread on this but it was in Java and Python which won't help me much. Please let me know, thanks.
Asked
Active
Viewed 2.7k times
3
-
Can't you just convert the Java/python to javascript? – vfilby Apr 21 '10 at 14:26
1 Answers
18
You could use Proj4js, as follows.
Download Proj4JS from GitHub, using this link.
The following code will convert from UTM to longitude latitude
<html>
<head>
<script src="proj4.js"></script>
<script>
var utm = "+proj=utm +zone=32";
var wgs84 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
console.log(proj4(utm,wgs84,[539884, 4942158]));
</script>
</head>
<body>
</body>
</html>
In this code, the UTM zone is 32, as should be obvious. The Easting is 539884, and the Northing is 4942158. The result is:
[9.502832656648073, 44.631671014204365]
Which is to say 44.631671014204365N, 9.502832656648073E. Which I have verified is correct.
If you need other projections, you can find their strings here.

Richard
- 56,349
- 34
- 180
- 251