OrientDB geolocation

落花浮王杯 提交于 2019-12-07 05:59:49

问题


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!


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/23032138/orientdb-geolocation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!