Learn R Programming

geosphere (version 1.6-5)

intermediate: Intermediate points on a great circle (sphere)

Description

Get intermediate points (way points) between the two locations with longitude/latitude coordinates. gcIntermediate is based on a spherical model of the earth and internally uses distCosine.

Usage

gcIntermediate(p1, p2, n=50, breakAtDateLine=FALSE, addStartEnd=FALSE, 
				output=NULL, sepNA=FALSE, sp=FALSE)

Value

matrix or list with intermediate points

Arguments

p1

longitude/latitude of a single point, in degrees. This can be a vector of two numbers, a matrix of 2 columns (first one is longitude, second is latitude) or a spatial points object from terra (SpatVector) of sf

p2

as for p1

n

integer. The desired number of intermediate points

breakAtDateLine

logical. Return two matrices if the dateline is crossed?

addStartEnd

logical. Add p1 and p2 to the result?

output

character. One of "list", "matrix", "sv" (SpatVector), "sf" or "sp". If NULL, the output is as in previous versions of this package for backwards compatibility

sepNA

logical. Separate matrix values for different points by a row of NA values? (e.g., for use in 'plot')

sp

logical. Depracated. Return a SpatialLines object?

Author

Robert Hijmans based on code by Ed Williams (great circle)

References

https://www.edwilliams.org/avform147.htm#Intermediate

Examples

Run this code
gcIntermediate(c(5,52), c(-120,37), n=6, addStartEnd=TRUE)

Run the code above in your browser using DataLab