intermediate: Intermediate points on a great circle (sphere)

intermediateR Documentation

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) 

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?

Value

matrix or list with intermediate points

Author(s)

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

References

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

Examples

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

geosphere documentation built on March 2, 2026, 9:06 a.m.