numpy 执行坐标系变换的库?[已关闭]

tquggr8v  于 2022-12-13  发布在  其他
关注(0)|答案(2)|浏览(136)

**已关闭。**此问题不符合Stack Overflow guidelines。当前不接受答案。

我们不允许问题寻求书籍、工具、软件库等的建议。您可以编辑问题,以便使用事实和引文来回答。
五年前就关门了。
Improve this question
有没有一个python库可以处理坐标系转换?我正在处理numpy meshgrid,但有时切换坐标系是有用的。因为我不想重复发明轮子,有没有任何库可以处理:

  • 变换(笛卡尔变换、球面变换、极坐标变换...)
  • 翻译
  • 轮换?
7kjnsjlb

7kjnsjlb1#

关于变换和旋转,我发现Christoph Gohlke的transformations.py非常有用。

xnifntxz

xnifntxz2#

您可以使用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('epsg:4326'),
    pyproj.Proj('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())

(from(http://pcjericks.github.io/py-gdalogr-cookbook/projection.html

相关问题