Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OrientDB geolocation

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:

  1. What is the X, Y, and the 30 values?
  2. Are the values (52.20472, 0.14056) latitude and longitude?

Thanks!

like image 761
andresmafra Avatar asked Apr 12 '14 15:04

andresmafra


2 Answers

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

like image 128
thegreatgiver Avatar answered Jan 01 '23 14:01

thegreatgiver


As mentioned this group and answered by @Opeoluwa, the distance is in Kilometers!

like image 33
andresmafra Avatar answered Jan 01 '23 15:01

andresmafra