【发布时间】:2019-06-10 14:42:01
【问题描述】:
给定一个 (lon, lat) 点 (5.068913, 52.067567),我想使用 pyproj 将 EPSG 4326 转换为 EPSG 28992。
pyproj 中的 Proj 和 transform 函数似乎都适合这样的任务:
- https://pyproj4.github.io/pyproj/dev/api/proj.html?highlight=proj#pyproj-proj
- https://pyproj4.github.io/pyproj/dev/api/transformer.html?highlight=transform#pyproj-transform
当我使用Proj 函数时,我得到的结果与使用transform 不同,为什么?
例如
from shapely.geometry import Point
from pyproj import Proj, transform
from matplotlib import pyplot as plt
x1, y1 = 5.068913, 52.067567
in_proj = Proj(init='epsg:4326')
out_proj = Proj(init='epsg:28992')
point1 = Point(out_proj(x1, y1))
point2 = Point(transform(in_proj, out_proj, x1 ,y1))
print(point1 == point2)
fig, ax = plt.subplots()
x, y = point1.xy
ax.plot(x, y, 'ro')
x, y = point2.xy
ax.plot(x, y, 'ro')
【问题讨论】:
标签: python gis coordinate-systems pyproj