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:
- What is the X, Y, and the 30 values?
- Are the values (52.20472, 0.14056) latitude and longitude?
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!
Basically that is just an example of the usage. And it is just showing on how you could select items which are as close or closer than 30 from the position (52.20472, 0.14056) expressed as degreees.
If I understood right then the X & Y should be the name of the position values with the items.