Skip to main content
Version: current [25.x]

Categories: Geospatial

GEO_BEYOND

Returns whether or not the two points are beyond the distance specified in meters.

Syntax

GEO_BEYOND(lat1 float, lon1 float, lat2 float, lon2 float, distance double) → boolean

  • lat1: The latitude of the source location in degrees.
  • lon1: The longitude of the source location in degrees.
  • lat2: The latitude of the destination location in degrees.
  • lon2: The longitude of the destination location in degrees.
  • distance: The specified distance between the two points in meters.

Examples

Determine whether the distance from Venice, Italy to Paris, France is greater than 800,000 meters.
SELECT GEO_BEYOND(CAST(45.4408 AS FLOAT), CAST(12.3155 AS FLOAT), CAST(48.8566 AS FLOAT), CAST(2.3522 AS FLOAT), CAST(800000 AS DOUBLE))
-- True

Usage Notes

The lat and lon parameters to this function can only be the FLOAT data type. The distance parameter can only be the DOUBLE data type. You must CAST other data types for lat and lon to FLOAT and the distance parameter to DOUBLE. This function calculates the result using the Haversine distance algorithm.