Skip to content
Snippets Groups Projects
Commit 40649d20 authored by Rudolf, Michael's avatar Rudolf, Michael
Browse files

Fixed a problem with empty API responses

parent 72edf0e9
Branches
No related tags found
No related merge requests found
......@@ -227,7 +227,9 @@ def _save_features(
:return: A geodataframe with the features in EPSG:32632
:rtype: gp.GeoDataFrame
"""
if isinstance(features, dict):
if len(features) == 0:
gdf = gp.GeoDataFrame(geometry=[])
elif isinstance(features, dict):
with open(out_fname + ".json", "wt") as geojson:
json.dump(features, geojson)
gdf = gp.read_file(out_fname + ".json").to_crs("EPSG:32632")
......@@ -288,7 +290,10 @@ def _query_server(
restgeom = polygon_to_restapi(
region.geometry[0], region.crs.to_string()
)
try:
features = ms_lyr.select_by_location(restgeom)
except restapi.RestAPIException:
features = []
else:
features = ms_lyr.query()
return features
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment