deg.dist: Haversine Distance Formula

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Haversine formula to calculate distances between points on the earth

Usage

1
2
3
4
5
6
deg.dist(
	long1, 
	lat1, 
	long2, 
	lat2
)

Arguments

long1

longitude of location 1

lat1

latitude of location 1

long2

longitude of location 2

lat2

latitude of location 2

Details

This function will calculate the shortest distance (portion of a Great Circle) in kilometers between two points on the Earth given their latitude and longitude.

Value

Arc distance between two points on the Earth's surface in kilometers.

Note

The distance calculated may be up to 0.2% inaccurate, as this function treats the Earth as a sphere with a circumference of 40041.47 km (mean circumference), rather than an ellipsoid like it actually is.

Author(s)

Matthew Vavrek

References

The formulas for the Haversine distance function were taken from the Dr. Math website at http://mathforum.org/library/drmath/view/55417.html

See Also

To calculate pairwise distances between a list of points see earth.dist, or to calculate an area enclosed by three points on the Earth's surface, see earth.tri

Examples

1
2
##distance between 23 degrees N 54 degrees E and 32 degrees S 67 degrees E
deg.dist(23,54,-32,67)

Example output

Loading required package: sp
Loading required package: maps
Loading required package: shapefiles
Loading required package: foreign

Attaching package: 'shapefiles'

The following objects are masked from 'package:foreign':

    read.dbf, write.dbf

[1] 3201.619

fossil documentation built on March 23, 2020, 5:06 p.m.