【学习笔记·一】python 坐标转换——以ESRI投影坐标与EPSG地理坐标转换为例

ESRI坐标系World Mercator(ESRI:54004)是投影坐标系,由于学习中遇到相关需求,需要将其数据在leaflet中进行展示,但是由于leaflet加载的在线瓦片图为wgs84(EPSG:4326)的地理坐标系,所以需要对其进行坐标转换。

https://epsg.io/54004
图1  https://epsg.io
https://epsg.io/54004
图2  输出文件类型

 

(对坐标系不明确的同学强力推荐使用https://epsg.io/网站进行查询,还可以输出不同需求的坐标类型) 

由于系统为ubuntu,无法使用arcgis软件,所以利用python进行批量转换。


参考网站:

https://pypi.org/project/PyCRS/

环境:

python3.6

import:

pyproj

pycrs

demo:

def esri2epsg(x, y):
    esri_crs = pycrs.parse.from_esri_code(54004)
    esri_crs_proj4 = esri_crs.to_proj4()
    epsg_crs = pycrs.parse.from_epsg_code(4326)
    epsg_crs_proj4 = epsg_crs.to_proj4()
    fromproj = pyproj.Proj(esri_crs_proj4)
    toproj = pyproj.Proj(epsg_crs_proj4)
    return pyproj.transform(fromproj, toproj, x, y)

可以根据自己的需求调用不同的函数

转载自:https://blog.csdn.net/qq_40153886/article/details/88666468

You may also like...