distance_in_meters(...)
Returns the distance between two Points in meters
Works with the following datatypes:
This function works with 2.1 endpoint(s). What does this mean? »
The distance_in_meters(...)
function will return the distance, measured in meters, between two Point
s. It accepts two parameters, both of which must be Points, either referenced as field names or encoded as Well-Known Text (WKT):
WKT is a standard way of encoding geospatial data in a textual manner, and is more compact than GeoJSON. For example, a Point would be encoded as:
POINT (-87.637714 41.887275)
Heads up! Contrary to the normal convention of "latitude, longitude" ordering in the coordinates
property, Well-known text orders the coordinates as "longitude, latitude" (X coordinate, Y coordinate), as other GIS coordinate systems are encoded.
For example, the below query will return the distance from Volunteer Park to the Socrata offices:
Meters not your thing? That’s easy to fix with a little math:
The distance_in_meters(...)
function can also be used to sort data by range. The below query will return the 5 closest parks to our office: