Learn R Programming

SDMTools (version 1.1-221)

destination: Vincenty Direct Calculation of a Destination

Description

destination estimates the destination latitude and longitude given a starting latitude and longitude, a bearing and distance. For general information on Vincenty's formula, see e.g., http://en.wikipedia.org/wiki/Vincenty's_formulae. It states: Vincenty's formulae are two related iterative methods used in geodesy to calculate the distance between two points on the surface of an spheroid, developed by Thaddeus Vincenty in 1975. They are based on the assumption that the figure of the Earth is an oblate spheroid, and hence are more accurate than methods such as great-circle distance which assume a spherical Earth. Note: this method assumes a locations are lat & lon given in WGS 84.

Usage

destination(lat, lon, bearing, distance)

Arguments

lat
a single value or vector of values representing latitude in decimal degrees from -90 to 90 degrees.
lon
a single value or vector of values representing longitude in decimal degrees from -180 to 180 degrees.
bearing
a single value or vector of values representing the bearings (directions) of interest ranging from 0 to 360 degrees.
distance
a single value or vector of values representing the distances in metres to the destination.

Value

Returns a data.frame with:
lon1
the original longitude
lat1
the original latitude
bearing
the bearing used
distance
the distance used
lon2
the destination longitude
lat2
the destination latitude

Source

The source code here was modified from http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html. Destinations were validated against Geoscience Australia calculations (http://www.ga.gov.au/geodesy/datums/vincenty_direct.jsp).

Details

Typical useages are:
  1. a single start location, bearing and distance to give a single output location --output would be a single destination location
  2. a single start location with one or more bearings or distances to give multiple output locations --output would be a destination locations for each combination of bearings and distances
  3. multiple start locations with a single bearing or distance --output would be a destination locations representing the bearing and distance from each of the start locations
  4. multiple start locations with multiple bearings or distances --output would be a destination locations representing the combinations of bearings and distances from each of the start locations -- NOTE that the bearing and distance vectors must be of the same length of the input lat and long.

See examples for all possible usages.

References

Vincenty, T. 1975. Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of Nested Equations. Survey Review, vol XXII no 176. http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf

Examples

Run this code
###single lat lons
lats = -85; lons = 165
#single bearing & single distance
destination(lats,lons,bearing=180,distance=500000)

#multiple bearings
destination(lats,lons,bearing=seq(0,360,length.out=9),distance=500000)

#multiple bearings
destination(lats,lons,bearing=45,distance=seq(0,5000000,length.out=11))

#multiple bearings, multiple distances
destination(lats,lons,bearing=seq(0,360,length.out=9),
    distance=seq(0,5000000,length.out=11))

###multiple lat lons
lats = seq(-90,90,length.out=9); lons = seq(-180,180,length.out=9)

#multiple lat lons but single bearings / distances
destination(lats,lons,bearing=45,distance=500000)

#different bearings for each lat lon
destination(lats,lons,bearing=seq(0,360,length.out=9),distance=500000)

#different distances for each lat lon
destination(lats,lons,bearing=45,distance=seq(0,5000000,length.out=9))

#different bearings & distances for each lat lon
destination(lats,lons,bearing=seq(0,360,length.out=9),
    distance=seq(0,5000000,length.out=9))

Run the code above in your browser using DataLab