lat/lon到utm到lat/lon的漏洞非常严重,怎么来的? [英] lat/lon to utm to lat/lon is extremely flawed, how come?

查看:217
本文介绍了lat/lon到utm到lat/lon的漏洞非常严重,怎么来的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下方法, 输入:经/纬度数据 然后我将围绕它计算一个框,假设是50 m,那么东/北值就为+/- 50 m.

I've tried the following, input: lat/lon data then I'll calculate a box around it by, let's say 50 m, so +/- 50 m on easting/northing value.

现在,我使用脚本将其转换为经/纬度:

Now I reconvert it to lat/lon and with a script:

http://robotics.ai.uiuc.edu/~hyoon24/LatLongUTMconversion. py 我得到的结果是不可能的,lon之前大约是7,之后大约2.

http://robotics.ai.uiuc.edu/~hyoon24/LatLongUTMconversion.py I get a result that just can't be, lon before is around 7, afterwards around 2.

zone, easting, northing = LLtoUTM(23, location.get_lat(), location.get_lon()) 

topUTM = northing + error
bottomUTM = northing - error
leftUTM = easting - error
rightUTM = easting + error
left, top = UTMtoLL(23, leftUTM, topUTM, zone)

是我的代码中的错误,还是脚本有缺陷?

Is the error in my code, or might be the script flawed?

因此,我尝试使用pyproj,只需将lat/lon转换为utm,再将lat/lon转换为lat/lon即可,

So I've tried to use pyproj, just lat/lon to utm to lat/lon to see what happens

>>> p = pyproj.Proj(proj='utm', zone=32, ellps='WGS84')
>>> p
<pyproj.Proj object at 0x7ff9b8487dd0>
>>> x,y = p(47.9941214, 7.8509671)
>>> print x,y
5159550.36822 1114087.43925
>>> print p(x,y,inverse=True)
(47.971558538495991, 7.8546573140162605)

在这里,它与上面的脚本并没有那么遥不可及,但是似乎仍然很不正确,以至于无法使用它.怎么会?我该怎么做才能获得更准确的结果?

And here it's not as extremely far off as with the script from above, but it still seems strongly enough incorrect as to not be able to use it. How come? What can I do to get more exact results?

我运行了test(),所有测试都通过了.

I ran test() and it all tests passed.

在epsg文件中没有这样的东西.我找到的最接近的是:

in epsg file there is no such thing. The closest I've found was this:

<32632> +proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs <>

没有tmerc.另外,我需要将towgs84作为参数传递吗?上面的那些?

no tmerc. Also What would I need to pass the towgs84 as parameters? The ones above?

推荐答案

上周,我为Python创建了一个小型的UTM转换库,并将其上传至Python软件包索引:

I've created a small UTM conversion library for Python last week and uploaded it to the Python Package Index: http://pypi.python.org/pypi/utm

我将其与使用pyproj进行了比较,它更快,更准确.给定您的样本数据,结果如下:

I have compared it to using pyproj and it is faster and more accurate. Given your sample data, this is the result:

>>> import utm

>>> u = utm.from_latlon(47.9941214, 7.8509671)
>>> print u
(414278, 5316285, 32, 'T')

>>> print utm.to_latlon(*u)
(47.994157948891505, 7.850963967574302)

更新:以下是Richards 答案,介绍了此问题的真正解决方案.

UPDATE: Richards answer below describes the real solution for this issue.

这篇关于lat/lon到utm到lat/lon的漏洞非常严重,怎么来的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆