Learn R Programming

MGDrivE (version 1.6.0)

calcCos: Calculate Geodesic Distance - Cosine Method

Description

This function calculates geodesic distance using the cosine method.

Usage

calcCos(latLongs, r = 6378137)

Arguments

latLongs

Two column matrix of latitudes/longitudes

r

Earth radius. Default is WGS-84 radius

Examples

Run this code
# NOT RUN {
# two-column matrix with latitude/longitude, in degrees
latLong = cbind(runif(n = 5, min = 0, max = 90),
                runif(n = 5, min = 0, max = 180))

# cosine distance formula
distMat = calcCos(latLongs = latLong)

# }

Run the code above in your browser using DataLab