I'd like to be able to create a new GeoPandas object and inherit the CRS from Rasterio, and save a shapefile. The current projection format is seen as invalid when writing an ESRI driver.
From here, it would suggest GeoPandas requires CRS in dict format: https://geopandas.org/projections.html and Reprojecting data with GeoPandas using 'to_crs'?, though this hints as dataset.crs.data (How can I superimpose a geopandas dataframe on a raster plot?).
It seems to be known that you must pass the crs_wkt directly to geopandas.to_file method: GeoPandas to_file() saves GeoDataFrame without coordinate system
simple psuedo code
boxes = geopandas.GeoDataFrame()
with rasterio.open(raster_path) as dataset:
boxes.crs = dataset.crs.to_dict()
boxes.to_file(<filename>,driver="ESRI Shapefile",crs_wkt=boxes.crs)
yields
TypeError: invalid crs_wkt
The specific projection i'm trying is:
dataset.crs.to_dict()
{'proj': 'lcc',
'lat_1': 43,
'lat_2': 45.5,
'lat_0': 41.75,
'lon_0': -120.5,
'x_0': 399999.9999999999,
'y_0': 0,
'ellps': 'GRS80',
'units': 'ft',
'no_defs': True}
Though I've played around with others, so I think its a workflow issue.
Rasterio version: 1.1.2 GeoPandas version: 0.6.2 Fiona version: 1.8.13
As an added comment, opening the raster in R and extracting the proj 4 string
> proj4string(a)
[1] "+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=399999.9999999999 +y_0=0 +ellps=GRS80 +units=ft +no_defs"
and assigning the string into boxes.crs above yields no error.