Skip to main content
3 of 3
Added CRS, as EPSG codes cover more than CRS, but the question in concerned with CRS
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

EPSG CRS Error Trap

I'm using pyproj and I'd like to run an error trap on the EPSG CRS code. Specifically, if the user enters a EPSG CRS code that is not in the proj database, it would provide a Boolean flag I can check before proceeding. I currently get this message if I enter a bad EPSG CRS:

File "pyproj\_crs.pyx", line 2338, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: epsg:000: (Internal Proj Error: proj_create: crs not found)