将 NAD83 UTM 转换为纬度和经度时出现问题
编辑 因此,我从 Jenner 在 VBforums 发布的解决方案显然是用 VB 编写的,我使用在线转换器将其移植到 C#。翻译过程中丢失了一些东西,这就是为什么它偏离了 10 英里。
我猜我只是误解了 Proj.Net 讨论板上的算法的用途,这就是为什么他们没有按照我的意愿行事。
我将在两天内结束这个问题,届时我可以标记我的答案,除非有人提供了很棒的东西。
我在将 UTM 转换为纬度和经度时遇到问题。例如,我有以下 NAD83 UTM 坐标:
Easting: 686029.702258
Northing: 3581213.621173
zone: 15
我在 vbforums 不久前给了我一个位于我预期的位置以南约 10 英里处。我在此处找到了一个简单的数学解决方案,给了我意想不到的结果。
double[] inverseMercator (double x, double y) {
double lon = (x / 20037508.34) * 180;
double lat = (y / 20037508.34) * 180;
lat = 180/Math.PI * (2 * Math.Atan(Math.Exp(lat * Math.PI / 180)) - Math.PI / 2);
return new double[] {lon, lat};
}
double[] toPoint = inverseMercator (686029.702258, 3581213.621173);
我得到以下结果:
lat: 30.602349476368449
long: 6.1627096689832594
我在同一线程中使用 D_Guidi 提供的 Proj.Net 解决方案得到类似的结果。
使用在线转换器,我能够得到更接近我所期望的结果:
lat:32.35238307052292
long:-91.0230710652583
任何人都可以阐明我做错了什么吗?
编辑 - 更喜欢 .NET 解决方案或易于转换的东西
Edit So the solution I posted from Jenner at VBforums was, obviously, in VB, and I used an online converter to port it to C#. Something was lost in translations, and that's why it was 10 miles off.
I'm guessing I am just misunderstanding what the algorithms at the Proj.Net discussion boards are for and that's why they weren't doing what I wanted them to.
I will close this question out in two days when I can mark my answer unless someone provides something awesome.
I am having issues converting UTM to lat and long. As an example, I have the following NAD83 UTM coordinate:
Easting: 686029.702258
Northing: 3581213.621173
zone: 15
A solution I found on vbforums a while ago gives me a point about 10 miles south of where I would expect it. A simple mathematical solution I found here, is giving me unexpected results.
double[] inverseMercator (double x, double y) {
double lon = (x / 20037508.34) * 180;
double lat = (y / 20037508.34) * 180;
lat = 180/Math.PI * (2 * Math.Atan(Math.Exp(lat * Math.PI / 180)) - Math.PI / 2);
return new double[] {lon, lat};
}
double[] toPoint = inverseMercator (686029.702258, 3581213.621173);
I get the following result:
lat: 30.602349476368449
long: 6.1627096689832594
I get similar results using the Proj.Net solution provided by D_Guidi in the same thread.
Using an online converter, I was able to get something closer to what I am expecting:
lat: 32.35238307052292
long: -91.0230710652583
Can anyone shed any light on what I am doing wrong?
Edit - would prefer .NET solutions or something that would be easily convertible
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过“proj”中包含的cs2cs二进制文件(投影,http://trac.osgeo.org/proj/ )?我相信这可以准确地将 UTM 转换为东向/北向和纬度/经度。问题是简单的数学公式并不能准确、足够地解释地球的形状。
Have you tried the cs2cs binary contained in "proj" (projection, http://trac.osgeo.org/proj/)? I believe that will do an accurate job converting UTM to easting/northing and lat/lon. The trouble is simple math formula do not accurately, enough, account for the shape of the earth.
因此,我从 Jenner 在 VBforums 上发布的解决方案显然是用 VB 编写的,我使用在线转换器将其移植到 C#。翻译过程中丢失了一些东西,这就是为什么它偏离了 10 英里。
我猜我只是误解了 Proj.Net 讨论板上的算法的用途,这就是为什么他们没有按照我的意愿行事。
So the solution I posted from Jenner at VBforums was, obviously, in VB, and I used an online converter to port it to C#. Something was lost in translations, and that's why it was 10 miles off.
I'm guessing I am just misunderstanding what the algorithms at the Proj.Net discussion boards are for and that's why they weren't doing what I wanted them to.