distance

Returns distance in meters from given latitude/longitude coordinates to datapoint

The datapoint is assumed to have latitude and longitude fields in decimal coordinates. It returns the distance in meters computed using the Haversine formula.

[
  {
    "latitude": 40.4277304,
    "longitude": -86.9170587
  }
]

Given the above stream, we find its distance to the chosen coordinate: distance(40.426841,-86.9165106):

[109.238]

The two coordinates above are about 109 meters apart.


Transform Details

Input SchemaOutput Schema
{
 "properties": {
  "latitude": {
   "type": "number"
  },
  "longitude": {
   "type": "number"
  }
 },
 "required": [
  "latitude",
  "longitude"
 ],
 "type": "object"
}
{
 "type": "number"
}

Arguments

#DescriptionTypeSchema
1Latitudeconst
{
 "type": "number"
}
2Longitudeconst
{
 "type": "number"
}