Skip to main content

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)

NameTypeDescription
geo_point1mandatoryThe first geo point for distance calculation. Geo points are longitude and latitude pairs.
geo_point2mandatoryThe second geo point for distance calculation. Geo points are longitude and latitude pairs.
unit_of_measureoptionalThe 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)

NameTypeDescription
longitudemandatoryThe longitude of the geo point in decimal units. Valid longitude values are between -180 and 180, both inclusive.
latitudemandatoryThe 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)

NameTypeDescription
geo_point1mandatoryThe first geo point for midpoint calculation. Geo points are longitude and latitude pairs.
geo_point2mandatoryThe 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)

NameTypeDescription
geo_point1mandatoryThe geo point to check whether it is within the radius of the center geo point. Geo points are longitude and latitude pairs.
geo_point_centermandatoryThe center geo point. Geo points are longitude and latitude pairs.
radiusmandatoryThe 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_measureoptionalThe unit of measure of the calculations. Can be either "km" or "miles".