Geocode functions

The geocode data type contains the longitude and latitude values that represent a geocode property.

Note that all distances are expressed in kilometers.

Function Description
LATITUDE(mdex:geocode) Returns the latitude of a geocode as a floating-point number.
LONGITUDE(mdex:geocode) Returns the longitude of a geocode as a floating-point number.
DISTANCE(mdex:geocode, mdex:geocode) Returns the distance (in kilometers) between the two geocodes, using the haversine formula.
TO_GEOCODE(mdex:double, mdex:double) Creates a geocode from the given latitude and longitude.
The following example enables the display of a map with a pin for each location where a claim has been filed:
RETURN Result AS
SELECT
        LATITUDE(geo) AS Lat,
        LONGITUDE(geo) AS Lon,
        DISTANCE(geo, TO_GEOCODE(42.37, 71.13)) AS DistanceFromCambridge
FROM ProductState
WHERE DISTANCE(geo, TO_GEOCODE(42.37, 71.13)) BETWEEN 1 AND 10

Note:

All distances are expressed in kilometers.