You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One option for supporting multiple geometries could be to simply convex hull them:
importjsonfromshapelyimportto_geojsonfromshapely.geometryimportshapefromshapely.opsimportunary_unionif (geom_type:=aoi_geojson.get("type")) =="FeatureCollection":
# Convert each feature into a Shapely geometrygeometries= [
shape(feature.get("geometry")) forfeatureinaoi_geojson.get("features", [])
]
merged_geom=unary_union(geometries)
elifgeom_type=="Feature":
merged_geom=shape(aoi_geojson.get("geometry"))
else:
merged_geom=shape(aoi_geojson)
# Convex hull with enclose all geometries in a single polygonmerged_aoi_polygon=json.loads(to_geojson(merged_geom.convex_hull))
It could also be possible to generate extracts based on multipolygons / multiple features, instead of enclosing in a convex hull, however I am sure this is more complex to implement.
If the user provides a feature collection with geoms very far apart (e.g. in different cities), then the merged AOI would be far too large. Extract generation would presumably fail.
This is low priority
Problem
/snapshot
accepts a JSON, with ageometry
key.Solution
python-geojson
,geojson-pydantic
, etc.Multiple Geometries
Additional context
The text was updated successfully, but these errors were encountered: