简体   繁体   English

在没有区域信息的情况下将 UTM 转换为纬度/经度

[英]Converting UTM to Lat/Long without zone information

I'm trying to convert UTM data (easting/northing) to lat/long, but the data I'm using doesn't have any zonal data.我正在尝试将 UTM 数据(东距/北距)转换为纬度/经度,但我使用的数据没有任何区域数据。

I know I could just use an online converter but I have thousands of rows so this isn't viable.我知道我可以只使用在线转换器,但我有数千行,所以这是不可行的。

The data is already in my notebook as a df, so ideally I want to replace the easting/northing columns with separate lat/long columns.数据已经作为 df 在我的笔记本中,所以理想情况下我想用单独的纬度/经度列替换东向/北向列。

Location_Easting位置_东 Location_Northing位置_北
530,171.0000 530,171.0000 179,738.0000 179,738.0000
515,781.0000 515,781.0000 174,783.0000 174,783.0000
531,614.0000 531,614.0000 184,603.0000 184,603.0000

I tried this line of code but I get a TypeError saying the 'module' is not callable我尝试了这行代码,但出现类型错误,提示“模块”不可调用

myProj = proj ("+proj=utm +zone=23K, +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs")

I know it asks for a zone but like I said I don't have this data.我知道它要求一个区域,但正如我所说,我没有这些数据。

Thanks in advance!提前致谢!

I've now made an educated guess to my UTM zone (30U), but when I run the below code (updated) I'm told the module is still not callable - from my understanding of this link it should be appropriate for my project?我现在对我的 UTM 区域 (30U) 做了一个有根据的猜测,但是当我运行下面的代码(更新)时,我被告知该模块仍然不可调用——根据我对这个链接的理解,它应该适合我的项目? https://pyproj4.github.io/pyproj/stable/api/proj.html https://pyproj4.github.io/pyproj/stable/api/proj.html

myProj = Proj ("+proj=utm +zone=30U, +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs")

I've since found code which will convert my metres and zone data to lat/long, but does anyone know how I can apply this to a whole dataframe (bus_stops)?我已经找到了将我的仪表和区域数据转换为纬度/经度的代码,但是有谁知道我如何将它应用于整个 dataframe (bus_stops)? posx should be column 'Location_Easting' and posy should relate to column 'Location Northing' posx 应该是“Location_Easting”列,而 posy 应该与“Location Northing”列相关

from shapely.geometry import Point

posx = 530,171
posy = 179,738.0000

# utm 24s is equivalent to epsg:32724
lon, lat = GeoSeries([Point(posx, posy)], crs='EPSG:32630').to_crs('epsg:4326')[0].coords[0] 

print(lon, lat)```

-7.483995602218547 0.0015423233602163576

The error message saying that module is not callable is an evidence that you are trying to directly use the module when you should use a class from it.指出模块不可调用的错误消息是您尝试直接使用该模块的证据,而您应该使用它的 class。

Here is an declaration example using the pyproj module:这是使用pyproj模块的声明示例:

import pyproj

myProj = pyproj.Proj ("+proj=utm +zone=30 +north +ellps=WGS84"
                      " +datum=WGS84 +units=m +no_defs")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pyproj 将 UTM 转换为纬度/经度 3 度 - pyproj conversion UTM to lat/long out by 3 deg dataframe 的经纬度到 UTM 转换失败 - Lat/Long to UTM conversion failing for dataframe 如何在Python中将UTM转换为纬度/经度? - How to convert the UTM to Lat/Long in Python? Bokeh Geoviews使用Lat / Long还是UTM? - Bokeh Geoviews use Lat/Long or UTM? 在Python中将经纬度长的数据库转换为utm数据 - Convert a database of lat long co-ordinates into utm data in Python 将 LatLong 转换为 UTM、向 UTM 添加偏移量以及将偏移量 UTM 转换回 LatLong 时如何处理可能的区域更改? - How to deal with possible zone changes when converting LatLong to UTM, adding offset to UTM, and converting offset UTM back to LatLong? 将地图坐标转换为纬度/经度 - converting map coordinates to lat/long 将十六进制CANbus消息转换为GPS long / lat - Converting Hex CANbus message to GPS long/lat 在 python 中将一列 MULTIPOLYGON 数据转换为 lat 和 long - Converting a column of MULTIPOLYGON data to lat and long in python 通过转换为utm计算纬度/经度距离与使用近似方法得出的结果不同 - Lat/lon distance calculation by converting to utm gives different results than using approximate method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM