Unable to parse GeoJSON when type is set after coordinates
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 50/100
Research direction
Reproduce the two GeoJSONReader.read calls with the LineString type placed before and after coordinates. Start at GeoJSONReader.readShapeFromCoordinates(GeoJSONReader.java:304), then trace readShape and read to determine why the property order causes a null value. Done means both inputs parse without a NullPointerException and equivalent shapes are returned.
Written by the indexing model from the issue text.
Description
When executing following code:
GeoJSONReader geojsonReader = new GeoJSONReader(new SpatialContext(new SpatialContextFactory()),
new SpatialContextFactory());
System.out.println("Type first:" + geojsonReader.read("{\"type\":\"LineString\", \"coordinates\":[[2.287563,48.862743],[2.287862,48.862958],[2.288109,48.863045]]}"));
System.out.println("Type second:" + geojsonReader.read("{\"coordinates\":[[2.287563,48.862743],[2.287862,48.862958],[2.288109,48.863045]],\"type\":\"LineString\"}"));
the following exception is thrown at line 3:
java.lang.NullPointerException
at org.locationtech.spatial4j.io.GeoJSONReader.readShapeFromCoordinates(GeoJSONReader.java:304)
at org.locationtech.spatial4j.io.GeoJSONReader.readShape(GeoJSONReader.java:248)
at org.locationtech.spatial4j.io.GeoJSONReader.read(GeoJSONReader.java:48)
at org.locationtech.spatial4j.io.GeoJSONReader.read(GeoJSONReader.java:54)
- Dominant language
- Java
- Stars
- 962
- Forks
- 174
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from locationtech/spatial4j
-
question
Difficulty 5/5 Over a week Newbie friendliness 20/100
locationtech/spatial4j#233 · 1 comment ·
-
Validation for self-intersection WKT Multipolygon fails at the WKTReader, while works when wrapped in a `GEOMETRYCOLLECTION`May be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
locationtech/spatial4j#232 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
locationtech/spatial4j#231 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
locationtech/spatial4j#230 · 2 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
locationtech/spatial4j#227 · 2 comments ·
All issues in locationtech/spatial4j
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Make branch and label autocomplete matching locale-independentPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
jenkinsci/gitlab-plugin#1950 ·
-
It's not necessary to copy the memory block in the readWrite() of org.h2.store.fs.mem.FileMemDataOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
h2database/h2database#4435 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
micronaut-projects/micronaut-core#13717 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ADORSYS-GIS/token-status-link#145 ·
Maintainers usually reply within 3 days