greatCircle: Great circle

Description Usage Arguments Value Author(s) References Examples

View source: R/greatCircle.R

Description

Get points on a great circle as defined by the shortest distance between two specified points

Usage

1
greatCircle(p1, p2, n=360, sp=FALSE) 

Arguments

p1

longitude/latitude of point(s). Can be a vector of two numbers, a matrix of 2 columns (first one is longitude, second is latitude) or a SpatialPoints* object

p2

as above

n

The requested number of points on the Great Circle

sp

Logical. Return a SpatialLines object?

Value

A matrix of points, or a list of such matrices (e.g., if multiple bearings are supplied)

Author(s)

Robert Hijmans, based on a formula provided by Ed Williams

References

http://www.edwilliams.org/avform.htm#Int

Examples

1
greatCircle(c(5,52), c(-120,37), n=36)

Example output

Loading required package: sp
       lon         lat
 [1,] -170 -48.1578258
 [2,] -160 -37.4620764
 [3,] -150 -21.4292761
 [4,] -140  -0.3878386
 [5,] -130  20.7643542
 [6,] -120  37.0000000
 [7,] -110  47.8571425
 [8,] -100  54.9024899
 [9,]  -90  59.5002369
[10,]  -80  62.4976247
[11,]  -70  64.3825856
[12,]  -60  65.4270092
[13,]  -50  65.7685930
[14,]  -40  65.4502820
[15,]  -30  64.4320903
[16,]  -20  62.5801021
[17,]  -10  59.6281858
[18,]    0  55.0979761
[19,]   10  48.1578258
[20,]   20  37.4620764
[21,]   30  21.4292761
[22,]   40   0.3878386
[23,]   50 -20.7643542
[24,]   60 -37.0000000
[25,]   70 -47.8571425
[26,]   80 -54.9024899
[27,]   90 -59.5002369
[28,]  100 -62.4976247
[29,]  110 -64.3825856
[30,]  120 -65.4270092
[31,]  130 -65.7685930
[32,]  140 -65.4502820
[33,]  150 -64.4320903
[34,]  160 -62.5801021
[35,]  170 -59.6281858
[36,]  180 -55.0979761

geosphere documentation built on May 2, 2019, 5:16 p.m.