我需要使用python中的utm模块以给定的纬度/经度位置获得一组以米为单位的坐标。如果位置跨越不同的区域,则地图将变得不正确。经过大量讨论,我还没有找到直接的解决方案。

lat_points = [42.827990, 42.849890, 42.824294]
long_points = [95.9, 95.903, 96.01]
xy_meters = [utm.from_latlon(lat,long) for (lat, long) in zip(lat_points,long_points)]
for row in xy_meters:
    print(row)


当区域越过时,结果显示出较大的间隙:

(737040.3354880156, 4745793.498913411, 46, 'T')
(737201.7056600684, 4748234.076861802, 46, 'T')
(255588.1599583785, 4745640.325228949, 47, 'T')

最佳答案

好的,我认为这段代码可以正常工作(切换程序包):

from pyproj import Proj
myProj = Proj("+proj=utm +zone=46T, +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
for lat, long in zip(lat_points,long_points):
    print(myProj(long, lat))


给出所需的:

(737040.3354579052, 4745793.4987486005)
(737201.7056297899, 4748234.076696485)
(746046.8172912733, 4745698.570316798)

关于python - 跨区域转换到一致的UTM时出现问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55712768/

10-12 12:27