dtDestination: dt destination

Description Usage Arguments Value Examples

Description

Calculates the destination coordinates from a starting point, initial bearing and distance travelling along a (shortest distance) great circle arc

Usage

1
dtDestination(latFrom, lonFrom, distance, bearing, r = earthsRadius())

Arguments

latFrom

latitude from (in degrees)

lonFrom

longitude from (in degrees)

distance

distance in metres

bearing

from north (in degrees)

r

radius of earth in metres

Value

list of latitude and longitude coordinates at the destination

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dtDestination(0, 0, earthsRadius(), 90)

n <- 10
set.seed(20170511)
lats <- -90:90
lons <- -180:180
b <- 0:360
dt <- data.table::data.table(lat = sample(lats, size = n, replace = T),
                             lon = sample(lons, size = n, replace = T),
                             bearing = sample(b, size = n, replace = T))
dt[, c("destinationLat", "destinationLon") := dtDestination(lat, lon, earthsRadius(), 90)]

SymbolixAU/spatial.data.table documentation built on May 9, 2019, 3:30 p.m.