geoDistance
#geoDistance Calculates the distance between two points in units (default is kilometers).
Syntax
geoDistance(point1, point2[, units])
Parameters
Parameter | Description |
---|---|
point1 | Required. GeoJSON Point specifying the origin. |
point2 | Required. GeoJSON Point specifying the destination. |
units | Optional. Specified as a string. Options are ‘degrees’, ‘radians’, ‘miles’, or ‘kilometers’. Default is ‘kilometers’. |
Example 1
Calculate the distance, in miles, between HarperDB’s headquarters and the Washington Monument.
Example 2
Find all locations that are within 40 kilometers of a given point, return that distance in miles, and sort by distance in an ascending order.
Last updated