diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-05-09 20:25:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 20:25:08 +0200 |
| commit | d41b99dba886d4b5974dde2f5dadf17647b659ff (patch) | |
| tree | 8bfd3349f236638f04bd4e7b8ca0373a92ac5003 /lib/utils | |
| parent | 21216f16166d2f978f439b86fd51d4e3fc995ae6 (diff) | |
handle GeometryCollections in ensure_polygon (#3708)
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/geometry.py | 4 |
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) |
