Skip to content

Missing roi CRS when parsed from geojson

The created object from GeoDataFrame.from_features is missing the crs info. Resulting in the following exception:

Start retrieving NWP data for modell cosmo-d2
Retrieving cosmo-d2_germany_regular-lat-lon_single-level_2020040909_000_TOT_PREC.grib2.bz2...
Traceback (most recent call last):
  File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/module.py", line 21, in <module>
    print(d.weatherprediction(nwp_model='cosmo-d2'))
  File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/de_sm_backend/nrt_io/downloader.py", line 569, in weatherprediction
    transformer = Transformer.from_crs(self.roi.crs, nwp_xr_merge.crs, always_xy=True)
  File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/env/lib/python3.7/site-packages/pyproj/transformer.py", line 320, in from_crs
    CRS.from_user_input(crs_from),
  File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/env/lib/python3.7/site-packages/pyproj/crs/crs.py", line 437, in from_user_input
    return CRS(value)
  File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/env/lib/python3.7/site-packages/pyproj/crs/crs.py", line 291, in __init__
    raise CRSError("Invalid CRS input: {!r}".format(projparams))
pyproj.exceptions.CRSError: Invalid CRS input: None

According to the Geojson specifications the default crs is 'epsg:4326'. We might have to set this to the roi, in case the from_features method couldn't derive the crs info from the passed geojson.