Skip to contents

Get distance (km) between two locations previously called gcd.hf

Usage

calc_distance(long1, lat1, long2, lat2)

Arguments

long1

Numeric Decimal degrees. Longitude of the first location.

lat1

Numeric Decimal degrees. Latitude of the first location.

long2

Numeric Decimal degrees. Longitude of the second location.

lat2

Numeric Decimal degrees. Latitude of the second location.

Value

Distance between locations in km.

Examples

calc_distance(long1 = 170, lat1 = 62, long2 = 170.1, lat2 = 62.1)
#> [1] 780.7205
calc_distance(long1 = -170, lat1 = -62, long2 = -170.1, lat2 = -62.1)
#> [1] 780.7205
calc_distance(long1 = 170, lat1 = -62, long2 = 170.1, lat2 = -62.1)
#> [1] 780.7205
calc_distance(long1 = 50, lat1 = 50, long2 = 50.1, lat2 = 50.1)
#> [1] 890.4222