ES|QL ST_DISTANCE function
geomA- Expression of type
geo_pointorcartesian_point. Ifnull, the function returnsnull. geomB-
Expression of type
geo_pointorcartesian_point. Ifnull, the function returnsnull. The second parameter must also have the same coordinate system as the first. This means it is not possible to combinegeo_pointandcartesian_pointparameters.
Computes the distance between two points. For cartesian geometries, this is the pythagorean distance in the same units as the original coordinates. For geographic geometries, this is the circular distance along the great circle in meters.
| geomA | geomB | result |
|---|---|---|
| cartesian_point | cartesian_point | double |
| geo_point | geo_point | double |
FROM airports
| WHERE abbrev == "CPH"
| EVAL distance = ST_DISTANCE(location, city_location)
| KEEP abbrev, name, location, city_location, distance
| abbrev:k | name:text | location:geo_point | city_location:geo_point | distance:d |
|---|---|---|---|---|
| CPH | Copenhagen | POINT(12.6493508684508 55.6285017221528) | POINT(12.5683 55.6761) | 7339.573896618216 |