Skip to content

distance

Syntax

distance(lat1, long1, lat2, long2)

Parameters

lat1
The latitude of the first coordinate.
long1
The longitude of the first coordinate.
lat2
The latitude of the second coordinate.
long2
The longitude of the second coordinate.

Returns

The decimal value of the distance in kilometers between the two points (lat1, long1) and (lat2, long2).

Description

Returns the Cartesian distance in kilometers between two points with the given latitude and longitude values.

Examples

If there are two locations with locations <40.441331568, -80.009499962> and <40.4472914, -80.0061645>, then the distance between these two locations can be determined and stored in a user-defined variable test_distance with:

test_distance = distance(40.441331568, -80.009499962, 40.4472914, -80.0061645)

See Also