4

I've been passed some GeoJSON shape data that I've been told is in the CRS ESRI:102001, although that property has not been written into the GeoJSON file. I've been able to confirm that is the correct CRS by converting it to EPSG:4326 using Python GDAL:

ds = gdal.VectorTranslate(input_file, srcDS=srcDS, srcSRS='ESRI:102001', dstSRS='EPSG:4326', format = 'GeoJSON', layerCreationOptions = ['RFC7946=YES', 'WRITE_BBOX=YES'])

I'd prefer to do the same in GeoPandas as I'm already using that for other tasks, while I'm only using GDAL for this one step. I've had a few goes at setting the CRS with no luck so far. This was my first effort:

inputGDF.crs = {'init' :'esri:102001'}
output_wgs84_GDF = inputGDF.to_crs("epsg:4326")

This fails on the 2nd line, with error:

pyproj.exceptions.CRSError: Invalid projection: +init=esri:102001 +type=crs: (Internal Proj Error: proj_create: cannot expand +init=esri:102001 +type=crs)

My second effort came from the proj4 info from:

https://spatialreference.org/ref/esri/102001/proj4/

inputGDF.crs = {'init' :'+proj=aea +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs'}
output_wgs84_GDF = inputGDF.to_crs('epsg:4326')

This throws a similar error:

pyproj.exceptions.CRSError: Invalid projection: +init=proj=aea +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +type=crs: (Internal Proj Error: proj_create: cannot expand +init=proj=aea +lat_1=50 +lat_2=70 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +type=crs)

Am I missing something?

  • Is the input data block really GeoJSON? That should have an SRID of 4326 to start. – Vince Jan 19 at 12:27
  • Please, include the output for: import sys; import pyproj; import geopandas; print(sys.version); print(pyproj.__version__); print(geopandas.__version__). – Gabriel De Luca Jan 19 at 13:09
  • @Vince - yeah I know, apparently ArcGIS can export in geojson format without a crs. I believe the geojson spec allows for any crs - or none. – Mike Honey Jan 19 at 22:02
  • @GabrielDeLuca - good point, sorry for not including that. Anyway snowman2 has a fix (below). – Mike Honey Jan 19 at 22:03
  • While other than 4326 is permitted, it is not recommended. – Vince Jan 20 at 1:24
5

The +init= syntax is deprecated. So all you need is the ESRI:102001 part. See: https://pyproj4.github.io/pyproj/stable/gotchas.html#init-auth-auth-code-should-be-replaced-with-auth-auth-code

inputGDF.crs = 'esri:102001'
  • thanks for the speedy fix! – Mike Honey Jan 19 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.