相关疑难解决方法(0)

lat/lon to utm to lat/lon是极其有缺陷的,怎么来的?

我已经尝试了以下输入:lat/lon数据然后我将计算它周围的一个方框,比方说50米,所以+/- 50米的东/北值.

现在我将它重新转换为lat/lon并使用脚本:

http://robotics.ai.uiuc.edu/~hyoon24/LatLongUTMconversion.py我得到的结果是不可能的,之前大约是7,之后是大约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)
Run Code Online (Sandbox Code Playgroud)

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

所以我试图使用pyproj,只需要lat/lon来指示lat/lon看看会发生什么

>>> 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)
Run Code Online (Sandbox Code Playgroud)

在这里它并不像上面的脚本那么遥远,但它似乎仍然不够正确,因为无法使用它.怎么会?我该怎么做才能获得更准确的结果?

编辑:

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

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

<32632> +proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs <> …
Run Code Online (Sandbox Code Playgroud)

python utm latitude-longitude

11
推荐指数
3
解决办法
2万
查看次数

在Python中矢量化Haversine距离计算

我正在尝试使用Haversine公式计算纬度和经度标识的一长串位置的距离矩阵,该公式采用两个坐标对元组来产生距离:

def haversine(point1, point2, miles=False):
    """ Calculate the great-circle distance bewteen two points on the Earth surface.

    :input: two 2-tuples, containing the latitude and longitude of each point
    in decimal degrees.

    Example: haversine((45.7597, 4.8422), (48.8567, 2.3508))

    :output: Returns the distance bewteen the two points.
    The default unit is kilometers. Miles can be returned
    if the ``miles`` parameter is set to True.

    """
Run Code Online (Sandbox Code Playgroud)

我可以使用嵌套for循环计算所有点之间的距离,如下所示:

data.head()

   id                      coordinates
0   1   (16.3457688674, 6.30354512503)
1   2    (12.494749307, 28.6263955635)
2   3    (27.794615136, 60.0324947881) …
Run Code Online (Sandbox Code Playgroud)

python performance numpy vectorization pandas

9
推荐指数
2
解决办法
2085
查看次数