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

The GeoJsonModule deserialize creates an invalid GeoJsonMultiPolygon #4586

Open
boundaries-io opened this issue Dec 10, 2023 · 5 comments
Open
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged

Comments

@boundaries-io
Copy link

boundaries-io commented Dec 10, 2023

The GeoJson deseralizer creates an invalid GeoJsonMultiPolygon that contain holes.

For example, while using a valid GeoJson MultiPolygon: Dallas, Texas GeoJson
image

invoking the method

	ObjectMapper mapper = new ObjectMapper();
	mapper.registerModule(GeoJsonModule.serializers());
	mapper.registerModule(GeoJsonModule.deserializers());

 	String dallas = FileUtils.readFileToString(new File("src/test/resources/raw_dallas.geojson"));
	GeoJsonMultiPolygon geoJsonMultiPolygon =  mapper.readValue(dallas, GeoJsonMultiPolygon.class);		 
 	String json =  getObjectMapper().writeValueAsString(geoJsonMultiPolygon);	
	Assert.assertEquals(dallas,json);//fails 	

The JSON is incorrect, the 'holes' that make up the original Multipolygon are being created incorrectly.
Invalid Dallas, Texas GeoJson
image

-Jeryl Cook

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 10, 2023
@christophstrobl
Copy link
Member

Thank you for reporting. It would be great if you have the time to help us work on this issue by providing a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Dec 11, 2023
@boundaries-io
Copy link
Author

Ok, I will create today

@boundaries-io boundaries-io reopened this Dec 12, 2023
@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 12, 2023
@boundaries-io
Copy link
Author

created a project with the failed test case: https://github.com/boundaries-io/spring-data-mongodb-4586

@christophstrobl
Copy link
Member

thank you for the reproducer, any chance to reduce the amount of json data to reproduce the issue? Something that does not necessarily hold hundreds of points but rather a minimal amount to show what's wrong.

@mp911de mp911de added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 14, 2023
@boundaries-io
Copy link
Author

boundaries-io commented Dec 16, 2023

Hi, The original geoJson is valid and comforms to the GeoJson Spec.( you can test via geojsonlint, or the JTS library, etc.)

I've added another unit test that uses a working Geojson serializer/deserializer from A Working GeoJson Serializer library

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

4 participants