passing roi as geojson string doesn't work
Passing the ROI as a Geojson string results in an exception:
Traceback (most recent call last):
File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/module.py", line 20, in <module>
d = downloader(roi=roi, average_spatial_values=True)
File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/de_sm_backend/nrt_io/downloader.py", line 191, in __init__
self.roi=gpd.GeoDataFrame.from_features(roi)
File "/home/eggert/workspace/python/de-smart-monitoring-backend-module/env/lib/python3.7/site-packages/geopandas/geodataframe.py", line 300, in from_features
d = {"geometry": shape(f["geometry"]) if f["geometry"] else None}
TypeError: string indices must be integers
I passed this geojson string:
{ "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[ [11.5, 52.5], [12.5, 52.5], [12.5, 53.5],
[11.5, 53.5], [11.5, 52.5] ]
]
}
}
]
}
According to http://geojsonlint.com/ the mentioned string is valid.
Maybe the from_features
method expects a dictionary instead of a string, try to parse the string via json.loads(roi)
before passing it on.