Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-31-2020 03:05 PM
I have used spatial functions successfully in earlier versions of neo4j but now gives error when I run on 4.0
match (g1:gps), (g2:gps)
return
distance(point({latitude:g1.latitude,longitude:g1.longitude}),point({latitude:g2.latitude,longitude:g2.longitude}))
No I get an error like this:
Cannot create WGS84 point with invalid coordinate: [37.09, -95.713]. Valid range for Y coordinate is [-90, 90].
03-31-2020 03:55 PM
Looks like your query might be blending 2D and 3D spatial logic.
When you plot the geographic coordinates on a two-dimensional map you apply a map projection. So when you plot the geographic locations in WGS84 on a map where you the horizontal axis represents longitude between -180° and +180° then the vertical axis represents latitude between -90° and +90° then you get a world map in the Plate Carree projection. - http://support.virtual-surveyor.com/en/support/solutions/articles/1000261351-what-is-wgs84-
Your longitude value -95.713 is invalid according to 2D. Have you tried specifying a CRS value like some of the examples here?
07-08-2021 01:42 PM
Hi @idrismunir check that g1 or g2 does not have latitudes outside the [-90, 90] range. I had a dataset that had >90 values and that gave me the same error.
When it says "invalid coordinate: [37.09, -95.713]" it is showing [longitude, latitude].
Hope this helps.
07-28-2022 05:57 AM
Hey, this question is quite old, but I also stumbled over it.
If you, like me, copied the example from the neo4j page to learn about it
WITH point({longitude: 12.78, latitude: 56.7, height: 100}) as p1, point({latitude: 56.71, longitude: 12.79, height: 100}) as p2 RETURN point.distance(p1,p2) as dist
you see, that they have mixed up the order of lats and longs in the two points, which screwed me, because I wasn't paying attention to that. So maybe you just got it wrong too and need to switch latitude and longitude.
All the sessions of the conference are now available online