Skip to content

fix(jts): align GEOMETRYCOLLECTION with MULTIPOLYGON WKT parse - #238

Open
arimu1 wants to merge 1 commit into
locationtech:masterfrom
arimu1:fix/issue-232-geometrycollection-multipolygon
Open

arimu1 wants to merge 1 commit into
locationtech:masterfrom
arimu1:fix/issue-232-geometrycollection-multipolygon

Conversation

@arimu1

@arimu1 arimu1 commented Sep 26, 2026 •

Copy link
Copy Markdown

Summary

Test plan

  • mvn test (full suite, JDK 17)
  • Manual repro: bare MULTIPOLYGON and wrapped GEOMETRYCOLLECTION both parse successfully on JtsSpatialContext.GEO

Contributor notes

Fixes #232

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validation for self-intersection WKT Multipolygon fails at the WKTReader, while works when wrapped in a GEOMETRYCOLLECTION

2 participants