简体   繁体   English

创建CRS时“投影无效”

[英]“Invalid projection” when creating a CRS

I am attempting to construct a CRS instance with PyProj to match a geographic shape to image bounds. 我正在尝试使用PyProj构建CRS实例,以将地理形状与图像范围进行匹配。 With the following code 用下面的代码

pyproj.Proj(proj='aea', lat1=b[1], lat2=b[3])

I am getting the error: 我收到错误消息:

pyproj.exceptions.CRSError: Invalid projection: +proj=aea
 +lat1=34.82176739999999 +lat2=34.8219931 +type=crs

There doesn't seem to be a lot of documentation about what makes a projection valid or invalid, apart from an apparently no longer extant documentation page on the Proj4 wiki. 除了Proj4 Wiki上似乎不再存在的文档页面外,关于使投影有效或无效的原因的文档似乎很少。 Can anyone help me to understand what's going wrong here? 谁能帮助我了解这里出了什么问题? The code (not written by me) appears to have worked in the past. 该代码(不是我写的)似乎在过去有效。

I think the issue here is you mispelled the projection parameters. 我认为这里的问题是您拼错了投影参数。

lat1 and lat2 should be lat_1 and lat_2 (with the underscore). lat1lat2应该分别是lat_1lat_2 (带下划线)。

The correct proj string should be: 正确的项目字符串应为:

+proj=aea +lat_1=34.82176739999999 +lat_2=34.8219931

You can find more details about the format of the proj string in the official documentation, linked here: https://proj4.org/operations/projections/aea.html 您可以在以下链接的官方文档中找到有关proj字符串格式的更多详细信息: https : //proj4.org/operations/projections/aea.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM