Learn R Programming

icosa (version 0.11.1)

arcdist: Calculation of distances along arcs

Description

This function calculates the shortest arc distance between two points.

Usage

arcdist(p1, p2, output = "distance", origin = c(0, 0, 0), radius = authRadius)

Value

A single numeric value.

Arguments

p1

(numeric) Vector, XYZ or longitude-latitude coordinates of the first point along the arc.

p2

(numeric) Vector, XYZ or longitude-latitude coordinates of the last point along the arc.

output

(character) The type of the output value. "distance" will give the distance in the metric that was fed to the function for the coordinates or the radius. "deg" will output the the distance in degrees, "rad" will do so in radians.

origin

(numeric) Vector, the center of the circle in XYZ coordinates (default is c(0,0,0)).

radius

(numeric) The radius of the circle in case the input points have polar coordinates only. Unused when XYZ coordinates are entered. Defaults to the authalic radius of Earth ca. 6371.007km.

Examples

Run this code
# coordinates of two points
point1<- c(0,0)
point2<- c(180,0)
arcdist(point1,point2,"distance")

Run the code above in your browser using DataLab