Important

This function is considered experimental and under active development and should not be used in production. It is expected to be released in a future version of LogScale.

This query function will calculate the distance between two geographical coordinates (lat1, lon1) and (lat2, lon2) along an ideal earth surface.

It uses the Haversine approximation, which is accurate to about 0.5%. It doesn't take the altitude into account.

Function Traits: FieldComputationFunction, Transformation

ParameterTypeRequiredDefaultDescription
asstringoptional_geodistance The name of the field that is produced by the function.
lat1stringrequired  The field to use for latitude of first point.
lat2stringrequired  The field to use for latitude of second point.
lon1stringrequired  The field to use for longitude of first point.
lon2stringrequired  The field to use for longitude of second point.

To calculate the distance between two geographical coordinates in meters, you could use this query function like so:

logscale
londonLat := 51.507222
| londonLon := -0.1275
| tokyoLat := 35.689722
| tokyoLon := 139.692222
| distance := geography:distance(lat1=londonLat, lon1=londonLon, lat2=tokyoLat, lon2=tokyoLon)