Learn R Programming

GeoRange (version 0.1.0)

gcd_hf: Calculates the geodesic distance between two points specified by latitude and longitude using the Haversine formula

Description

Calculates the geodesic distance between two points specified by latitude and longitude using the Haversine formula

Usage

gcd_hf(long1, lat1, long2, lat2)

Arguments

long1

- Longitudinal value of first point in decimal degrees

lat1

- Latitudinal value of first point in decimal degrees

long2

- Longitudinal value of second point in decimal degrees

lat2

- Latitudinal value of second point in decimal degrees

Value

Returns the distance between two points on the Earth in kilometers

Details

The Haversine formula can be inaccurate depending on coordinates

References

[1] Adapted from http://www.r-bloggers.com/great-circle-distance-calculations-in-r/

Examples

Run this code
long1<-22
lat1<-44
long2<-52
lat2<-51
gcd_hf(long1,lat1,long2,lat2)

Run the code above in your browser using DataLab