Skip to content

Fix GeoJson polygon conversion for multiple inner rings#5193

Open
DragonFSKY wants to merge 1 commit intospring-projects:mainfrom
DragonFSKY:GH-5190
Open

Fix GeoJson polygon conversion for multiple inner rings#5193
DragonFSKY wants to merge 1 commit intospring-projects:mainfrom
DragonFSKY:GH-5190

Conversation

@DragonFSKY
Copy link
Copy Markdown

@DragonFSKY DragonFSKY commented May 5, 2026

Closes #5190

This PR updates GeoConverters.toGeoJsonPolygon(...) to preserve all inner rings when reading a GeoJsonPolygon from a MongoDB Document.

The existing behavior for polygons without inner rings and with a single inner ring remains unchanged. Additional coordinate rings after the outer ring are now applied as inner rings.

Tests cover both direct GeoJsonPolygon conversion and the GeoJsonMultiPolygon path, since it reuses the same conversion method.

Tests:

  • ./mvnw -s settings.xml -pl spring-data-mongodb clean test '-Dtest=GeoJsonConverterUnitTests$DocumentToGeoJsonPolygonConverterUnitTests,GeoJsonConverterUnitTests$DocumentToGeoJsonMultiPolygonConverterUnitTests'

Checklist:

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Do not submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Closes spring-projects#5190

Signed-off-by: dragonfsky <dragonfsky@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GeoConverters does only support polygons with one hole?

2 participants