I´m using the OrientDB for NoSQL database, and i dont know how to query in geolocation exactly. I´ve read the specific documentation:
OrientDB Functions
but does not understand the significance of the values.
The distance function:
distance() - Computes the distance between two points in the globe using the Haversine algorithm. Coordinates must be as degrees
Example:
where distance(x, y,52.20472, 0.14056) <= 30
Two questions:
Thanks!
distance(x, y,52.20472, 0.14056) <= 30
x and y are the longitude and latitude (variables) respectively of the record/position which you are calculating distance from the fixed coordinates 52.20472, 0.14056.
consider another example:
select distance(longitude, latitude, 52.20472, 0.14056) <= 30 as distance from Places order by distance
This query will loop through the records in the Places Class/Cluster and for each record it injects the longitude and latitude of the record and calculate it's distance to the fixed position (52.20472, 0.14056) and return the places that are within 30m.
where
Places is a class/cluster which contains records of places longitude is the longitude field of the current record latitude is the latitude field of the current record distance is an alias for the field name
As mentioned this group and answered by @Opeoluwa, the distance is in Kilometers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With