1

我最初写了一个脚本来投影 x,y 坐标。我与同事分享了这段代码,我们似乎使用相同的脚本和相同的文件得到了不同的结果。我们在机器上安装了不同版本的 python 和 pyproj。从 NAD27 投影到 WGS84 时会出现此问题。有几种基准计算可用于执行此操作。

如何指定与 pyproj 一起使用的基准转换,以便我可以明确说明与 pyproj 一起使用的基准转换?

import pyproj

inProj =  pyproj.Proj(init='epsg:26714')
intermProj = pyproj.Proj(init='epsg:26914')
outProj = pyproj.Proj(init='epsg:32614')
y1,x1 = [6023700, 344288]
y2,x2 = pyproj.transform(inProj, intermProj, x1,y1)

print y2, x2

我希望 x、y 坐标与不同版本的 python 和 pyproj 相同,但事实并非如此。

4

1 回答 1

1

您可能对https://pyproj4.github.io/pyproj/stable/advanced_examples.html#transformation-groupTransformerGroup中介绍的感兴趣pyproj 2.3.0

使用它,您可以从可用列表中选择您感兴趣的特定转换:

>>> from pyproj.transformer import TransformerGroup
>>> tg = TransformerGroup(26714, 32614)
>>> for trans in tg.transformers:
...     print(repr(trans))
... 
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (79) + UTM zone 14N
Area of Use:
- name: USA - CONUS including EEZ
- bounds: (-129.17, 23.81, -65.69, 49.38)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (4) + UTM zone 14N
Area of Use:
- name: USA - CONUS - onshore
- bounds: (-124.79, 24.41, -66.91, 49.38)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (3) + UTM zone 14N
Area of Use:
- name: Canada - NAD27
- bounds: (-141.01, 40.04, -47.74, 83.17)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (6) + UTM zone 14N
Area of Use:
- name: USA - CONUS west of Mississippi River - onshore
- bounds: (-124.79, 25.83, -89.64, 49.05)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (18) + UTM zone 14N
Area of Use:
- name: Mexico - onshore
- bounds: (-118.47, 14.51, -86.68, 32.72)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (13) + UTM zone 14N
Area of Use:
- name: Canada - NWT; Nunavut; Saskatchewan
- bounds: (-136.46, 49.0, -60.72, 83.17)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (11) + UTM zone 14N
Area of Use:
- name: Canada - Manitoba and Ontario
- bounds: (-102.0, 41.67, -74.35, 60.01)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (5) + UTM zone 14N
Area of Use:
- name: USA - CONUS east of Mississippi River - onshore
- bounds: (-97.22, 24.41, -66.91, 49.38)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (84) + UTM zone 14N
Area of Use:
- name: USA - GoM OCS
- bounds: (-97.22, 23.82, -81.17, 30.25)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (82) + UTM zone 14N
Area of Use:
- name: USA - GoM - west of 95°W
- bounds: (-97.22, 25.97, -95.0, 28.97)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + NAD27 to WGS 84 (83) + UTM zone 14N
Area of Use:
- name: Mexico - offshore GoM - Tampico area
- bounds: (-98.1, 21.51, -96.89, 22.75)
<Concatenated Operation Transformer: pipeline>
Description: Inverse of UTM zone 14N + Ballpark geographic offset from NAD27 to WGS 84 + UTM zone 14N
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)

您还想检查您是否拥有所有可用于最佳转换的基准网格 ( https://pyproj4.github.io/pyproj/stable/installation.html#datum-grids )。

可以帮助您的另一部分是指定https://pyproj4.github.io/pyproj/v2.4.0rel/advanced_examples.html#area-of-interestAreaOfInterest中还介绍的pyproj 2.3.0

于 2019-09-25T00:37:29.910 回答