Skip to content

Commit e0e39b7

Browse files
authored
Try to simplify geometries that fail with TopologyException (#115834) (#115843)
This geometries are valid and they can actually be simplified so lets make the clipping algorithm a best effort and return the original geometry in those cases so the simplification can handle it.
1 parent a2550f0 commit e0e39b7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docs/changelog/115834.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 115834
2+
summary: Try to simplify geometries that fail with `TopologyException`
3+
area: Geo
4+
type: bug
5+
issues: []

x-pack/plugin/vector-tile/src/main/java/org/elasticsearch/xpack/vectortile/feature/FeatureFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,11 @@ private static org.locationtech.jts.geom.Geometry clipGeometry(
307307
return null;
308308
}
309309
} catch (TopologyException ex) {
310-
// we should never get here but just to be super safe because a TopologyException will kill the node
311-
throw new IllegalArgumentException(ex);
310+
// Note we should never throw a TopologyException as it kill the node
311+
// unfortunately the intersection method is not perfect and it will throw this error for complex
312+
// geometries even when valid. We can still simplify such geometry so we just return the original and
313+
// let the simplification process handle it.
314+
return geometry;
312315
}
313316
}
314317
}

0 commit comments

Comments
 (0)