Geolocation
DISTANCE
✔️ Safe to use in filter queries
Calculates the distance between two geo points. If the unit of measure is not specified, the distance is calculated in kilometers (km).
Syntax
DISTANCE(geo_point1, geo_point2, unit_of_measure)
Name | Type | Description |
---|---|---|
geo_point1 | mandatory | The first geo point for distance calculation. Geo points are longitude and latitude pairs. |
geo_point2 | mandatory | The second geo point for distance calculation. Geo points are longitude and latitude pairs. |
unit_of_measure | optional | The unit of measure of the distance. Can be either "km" or "miles". |
GEOPOINT
✔️ Safe to use in filter queries
Constructs and returns a geo point value given the constituent longitude and latitude properties.
Syntax
GEOPOINT(longitude, latitude)
Name | Type | Description |
---|---|---|
longitude | mandatory | The longitude of the geo point in decimal units. Valid longitude values are between -180 and 180, both inclusive. |
latitude | mandatory | The latitude of the geo point in decimal units. Valid longitude values are between -90 and 90, both inclusive. |
MIDPOINT
✔️ Safe to use in filter queries
Calculates the midpoint of two geo points and returns a new geo point representing the midpoint coordinates in longitude and latitude pairs.
Syntax
DISTANCE(geo_point1, geo_point2)
Name | Type | Description |
---|---|---|
geo_point1 | mandatory | The first geo point for midpoint calculation. Geo points are longitude and latitude pairs. |
geo_point2 | mandatory | The second geo point for midpoint calculation. Geo points are longitude and latitude pairs. |
WITHINRADIUS
✔️ Safe to use in filter queries
Checks whether geo_point1 is within the radius of geo_point_center. If the unit of measure is not specified, by default calculations are done in kilometers (km).
Syntax
WITHINRADIUS(geo_point1, geo_point_center, radius, unit_of_measure)
Name | Type | Description |
---|---|---|
geo_point1 | mandatory | The geo point to check whether it is within the radius of the center geo point. Geo points are longitude and latitude pairs. |
geo_point_center | mandatory | The center geo point. Geo points are longitude and latitude pairs. |
radius | mandatory | The radius of the circle which will have the geo point center as its center. Can be any expression that returns a numeric value. |
unit_of_measure | optional | The unit of measure of the calculations. Can be either "km" or "miles". |