Learn R Programming

geosphere (version 1.0.0)

midPoint: Mid-point

Description

Mid-point between two points along a great circle

Usage

midPoint(p1, p2)

Arguments

p1
longitude/latitude of point(s), in degrees; 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. Should be of same length of p1, or a single point (or vice versa when p1 is a single point

Value

  • A pair of coordinates (longitude/latitude)

Details

Just as the initial bearing may vary from the final bearing, the midpoint may not be located half-way between latitudes/longitudes; the midpoint between 35N,45E and 35N,135E is around 45N,90E.

References

http://www.movable-type.co.uk/scripts/latlong.html http://en.wikipedia.org/wiki/Great_circle_distance

Examples

Run this code
midPoint(c(0,0),c(90,90))

Run the code above in your browser using DataLab