Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dist2gc

Cross Track Distance


Description

Compute the distance of a point to a great-circle path (also referred to as the cross track distance or cross track error). The great circle is defined by p1 and p2, while p3 is the point away from the path.

Usage

dist2gc(p1, p2, p3, r=6378137, sign=FALSE)

Arguments

p1

Start of great circle path. 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

End of great circle path. As above

p3

Point away from the great cricle path. As for p2

r

radius of the earth; default = 6378137

sign

logical. If TRUE, a negative sign is used to indicated that the points are to the left of the great circle

Value

A distance in units of r (default is meters) If sign=TRUE, the sign indicates which side of the path p3 is on. Positive means right of the course from p1 to p2, negative means left.

Author(s)

Ed Williams and Robert Hijmans

References

See Also

Examples

dist2gc(c(0,0),c(90,90),c(80,80))

geosphere

Spherical Trigonometry

v1.5-10
GPL (>= 3)
Authors
Robert J. Hijmans [cre, aut], Ed Williams [ctb], Chris Vennes [ctb]
Initial release
2019-05-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.