python – 执行坐标系转换的库?
发布时间:2020-12-20 11:40:03 所属栏目:Python 来源:网络整理
导读:是否有一个处理坐标系转换的 python库? 我正在使用numpy meshgrids,但有时切换坐标系很有用. 由于我不想重新发明轮子,是否有任何库处理: 转换(笛卡儿,球形,极地,……) 翻译 轮换? 解决方法 您可以使用shapely库: http://toblerity.org/shapely/manual.ht
是否有一个处理坐标系转换的
python库?
我正在使用numpy meshgrids,但有时切换坐标系很有用. 由于我不想重新发明轮子,是否有任何库处理: >转换(笛卡儿,球形,极地,……) 解决方法
您可以使用shapely库:
http://toblerity.org/shapely/manual.html 仿射变换:http://toblerity.org/shapely/manual.html#affine-transformations 协调转换:http://toblerity.org/shapely/manual.html#other-transformations from shapely.geometry import Point from functools import partial import pyproj from shapely.ops import transform point1 = Point(9.0,50.0) print (point1) project = partial( pyproj.transform,pyproj.Proj(init='epsg:4326'),pyproj.Proj(init='epsg:32632')) point2 = transform(project,point1) print (point2) 您也可以使用ogr库.即 from osgeo import ogr from osgeo import osr source = osr.SpatialReference() source.ImportFromEPSG(2927) target = osr.SpatialReference() target.ImportFromEPSG(4326) transform = osr.CoordinateTransformation(source,target) point = ogr.CreateGeometryFromWkt("POINT (1120351.57 741921.42)") point.Transform(transform) print (point.ExportToWkt()) (自http://pcjericks.github.io/py-gdalogr-cookbook/projection.html起) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |