Skip to content

Commit b25aee6

Browse files
committed
Add guard against intersection errors
1 parent 6084960 commit b25aee6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tilequeue/transform.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from tilequeue.tile import bounds_buffer
99
from tilequeue.tile import normalize_geometry_type
1010
import math
11+
import shapely.errors
1112

1213

1314
half_circumference_meters = 20037508.342789244
@@ -153,7 +154,10 @@ def _clip_shape(shape, buffer_padded_bounds, is_clipped, clip_factor):
153154
shape = _intersect_multipolygon(
154155
shape, shape_buf_bounds, layer_padded_bounds)
155156
else:
156-
shape = shape.intersection(layer_padded_bounds)
157+
try:
158+
shape = shape.intersection(layer_padded_bounds)
159+
except shapely.errors.TopologicalError:
160+
return None
157161

158162
return shape
159163

0 commit comments

Comments
 (0)