aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webmap-download-mrr.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/webmap-download-mrr.py b/webmap-download-mrr.py
index 2477f8a..f839ac0 100644
--- a/webmap-download-mrr.py
+++ b/webmap-download-mrr.py
@@ -422,7 +422,11 @@ def triangulate(geom):
triangle = triangulation.GetGeometryRef(i)
if geom.Contains(triangle):
triangulation2.AddGeometry(triangle)
- return triangulation2
+ if triangulation2.IsEmpty():
+ # can happen in some degenerate cases
+ return triangulation
+ else:
+ return triangulation2
# Return the centroid (modulo rounding) if is within the input geometry,
# and None, None otherwise