Skip to content

Commit

Permalink
Add guard against intersection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarianski committed Jan 10, 2018
1 parent 6084960 commit b25aee6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tilequeue/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from tilequeue.tile import bounds_buffer
from tilequeue.tile import normalize_geometry_type
import math
import shapely.errors


half_circumference_meters = 20037508.342789244
Expand Down Expand Up @@ -153,7 +154,10 @@ def _clip_shape(shape, buffer_padded_bounds, is_clipped, clip_factor):
shape = _intersect_multipolygon(
shape, shape_buf_bounds, layer_padded_bounds)
else:
shape = shape.intersection(layer_padded_bounds)
try:
shape = shape.intersection(layer_padded_bounds)
except shapely.errors.TopologicalError:
return None

return shape

Expand Down

0 comments on commit b25aee6

Please sign in to comment.