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:

https://data.seattle.gov/resource/v5tj-kqhc.json?name='Volunteer Park'&$select=DISTANCE_IN_METERS(location_1, 'POINT(-122.3194183 47.6145784)') AS range

Meters not your thing? That’s easy to fix with a little math:

https://data.seattle.gov/resource/v5tj-kqhc.json?name='Volunteer Park'&$select=DISTANCE_IN_METERS(location_1, 'POINT(-122.3194183 47.6145784)') * 3.28084 AS range_in_feet

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:

https://data.seattle.gov/resource/v5tj-kqhc.json?$order=distance_in_meters(location_1, 'POINT(-122.3194183 47.6145784)')&$limit=5&$select=*, distance_in_meters(location_1, 'POINT(-122.3194183 47.6145784)') AS range