Conversation
JtsMultiShapeBuilder re-wrapped homogeneous children via makeShapeFromGeometry, which re-validated geometries that multi* builders already accept via makeShape. Return a lone child unchanged and use makeShape for homogeneous Multi* merges. Fixes locationtech#232 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
| } | ||
|
|
||
| return makeShapeFromGeometry(geometryFactory.buildGeometry(geoms)); | ||
| if (shapes.size() == 1) { |
There was a problem hiding this comment.
It's not clear why this check is here, relative to the fix. If this is an unrelated optimization, it could go at the start of build(); yes?
|
I rechecked #232 against current master (
That result is the same with and without the Closing this. The |
Summary
MULTIPOLYGONis accepted alone but rejected inside aGEOMETRYCOLLECTION(Validation for self-intersection WKT Multipolygon fails at the WKTReader, while works when wrapped in aGEOMETRYCOLLECTION#232).JtsMultiShapeBuildernow returns a single child shape unchanged (no re-wrap/re-validate) and usesmakeShapefor homogeneousMulti*merges, matchingJtsMultiPolygonBuilderand siblings.JtsSpatialContext.GEOand both WKT strings from the issue.Test plan
mvn test(full suite, JDK 17)MULTIPOLYGONand wrappedGEOMETRYCOLLECTIONboth parse successfully onJtsSpatialContext.GEOContributor notes
Fixes #232