Hi,
I store GPS latitude and longitude in document schema and would like to query my document database and filter on the nearest points.
A sample standard SQL query could looks like that:
SELECT geo_latitude, geo_longitude, geo_name, geo_country_code AS country,
(DEGREES(
ACOS(
SIN(RADIANS(47.470779)) * SIN(RADIANS(geo_latitude)) +
COS(RADIANS(47.470779)) * COS(RADIANS(geo_latitude)) *
COS(RADIANS(-87.890699 - geo_longitude))
)
) * 60 * 1.1515)
AS distance FROM `MyDatabase`.`allCountries` ORDER BY distance ASC LIMIT 20 ;
Is there a way in Nuxeo to execute Math operation in NXQL or requesting postgresql database directly?
Another solution could be to create a custom OperationChain and execute the Math operation in Java.
Thanks in advance