Javascript 如何将 UTM 转换为纬度/经度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2683739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to convert UTM to Lat/Long?
提问by Josh
回答by Richard
You could use Proj4js, as follows.
您可以使用 Proj4js,如下所示。
Download Proj4JS from GitHub, using thislink.
使用此链接从 GitHub 下载 Proj4JS 。
The following code will convert from UTM to longitude latitude
以下代码将从 UTM 转换为经度纬度
<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:
在这段代码中,UTM 区域是 32,这应该是显而易见的。东距为 539884,北距为 4942158。结果为:
[9.502832656648073, 44.631671014204365]
Which is to say 44.631671014204365N, 9.502832656648073E. Which I have verifiedis correct.
也就是说 44.631671014204365N,9.502832656648073E。我已经验证是正确的。
If you need other projections, you can find their strings here.
如果您需要其他投影,您可以在此处找到它们的字符串。

