summaryrefslogtreecommitdiff
path: root/lib/utils/geometry.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/geometry.py')
-rw-r--r--lib/utils/geometry.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py
index 568f883d..39bbd963 100644
--- a/lib/utils/geometry.py
+++ b/lib/utils/geometry.py
@@ -180,10 +180,12 @@ def ensure_multi_point(thing):
def ensure_polygon(thing):
- """Given a Polygon or a MultiPolygon
+ """Given a Polygon, a MultiPolygon or a GeometryCollection
Returns the Polygon or the biggest Polygon of the MultiPolygon"""
+ if thing.geom_type == "GeometryCollection":
+ thing = ensure_multi_polygon(thing)
if thing.geom_type == "MultiPolygon":
thing = list(thing.geoms)
thing.sort(key=lambda thing: thing.area, reverse=True)