spring-projects / spring-projects/spring-data-mongodb
The GeoJsonModule deserialize creates an invalid GeoJsonMultiPolygon
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
The GeoJson deseralizer creates an invalid GeoJsonMultiPolygon that contain holes.
For example, while using a valid GeoJson MultiPolygon: Dallas, Texas GeoJson
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
-Jeryl Cook
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with GeoJsonModule.deserializers() and the round-trip example using src/test/resources/raw_dallas.geojson. Compare the deserialized and reserialized GeoJsonMultiPolygon, focusing on how holes are represented in the Dallas fixture. Done means the original valid GeoJSON round-trips unchanged and the resulting multipolygon remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, json
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100