-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add a spatial function to convert WKT to Geo-JSON #406
base: master
Are you sure you want to change the base?
Add a spatial function to convert WKT to Geo-JSON #406
Conversation
ff6a85c
to
62b3b7a
Compare
62b3b7a
to
415522f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a useful function. But it also feels incomplete, missing a few geometry types, and with only one test for one type. I think we need both:
- Unit test for the GeoJsonUtils class that tests all types
- More spatial functions tests for at least a geometrycollection with various types
This is also an opportunity to make a function spatial.asGeoJson
that takes a geometry, or a node, and produces GeoJSON. That does not need to be in the PR, but seems like most of the work is already done for that since your implementation makes an intermediate Geometry.
src/main/java/org/neo4j/gis/spatial/functions/SpatialFunctions.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
private static List<?> getCoordinates(Geometry geometry) { | ||
if (geometry instanceof Point point) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing types here, like MultiPoint, MultiLineString, MultiPolygon. Should be easy enough to add these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/test/java/org/neo4j/gis/spatial/functions/SpatialFunctionsTest.java
Outdated
Show resolved
Hide resolved
6844765
to
bee28a4
Compare
This PR adds a new spatial function
spatial.convert.wktToGeoJson
to convert WKT to Geo-JSON.returns an object like