Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mixed geometry types when reading region sets from resources / statistical data #1085

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

ZakarFin
Copy link
Member

@ZakarFin ZakarFin commented Nov 22, 2024

Use the same logic to read GeoJSON in WFSClient and RegionSetHelper to workaround this: https://gis.stackexchange.com/questions/316134/reading-a-geojson-via-java-geotools-api-issue

When GeoTools is used to read the feature collection it will use the geometry type from the first feature. This results in region sets that have both Polygon and Multipolygon features look like this on the map (Multipolygons forced to Polygons if the first feature has a Polygon geometry):
image

Note that there's already a GeoJSONReader on geotools-ext Maven module, but it has very little dependencies. To keep it that way I added the GeoJSONStringReader to service-map that already has Jackson-databind as dependency.

@ZakarFin ZakarFin added this to the 2.14.0 milestone Nov 22, 2024
@ZakarFin
Copy link
Member Author

After running with this code:
image

@ZakarFin ZakarFin merged commit 48387ac into oskariorg:develop Nov 22, 2024
2 checks passed
@ZakarFin ZakarFin deleted the type-discovery branch November 22, 2024 13:05
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.

1 participant