简体   繁体   中英

“Invalid projection” when creating a CRS

I am attempting to construct a CRS instance with PyProj to match a geographic shape to image bounds. 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. 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).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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