dtDist2gc: Dist 2 gc

Description Usage Arguments Details Value Examples

Description

Finds the distance of a point to a great-circle path

Usage

1
2
dtDist2gc(latFrom, lonFrom, latTo, lonTo, pointLat, pointLon,
  tolerance = 1e+09, r = earthsRadius())

Arguments

latFrom

latitude value for the start of the path

lonFrom

longitude value for the sttart of the path

latTo

lattitude value for the end of the path

lonTo

longitude value for the end of the path

pointLat

latitude value for the point

pointLon

longitude value for the point

r

Details

Sometimes called 'cross-track' distance

Value

distance in metres. The sign of the result indicates if the point is to the left (negative) or right (positive) of the line when traveling from 'latFrom,lonFrom' to 'latTo,lonTo'.

Examples

1
2
3
4
5
6
7
8
dt <- data.table(lat1 = c(0, 0),
                 lon1 = c(0, 0),
                 lat2 = c(20, -20),
                 lon2 = c(0, 0),
                 plat = c(10, -10),
                 plon = c(22, 22))

dt[, dist := dtDist2gc(lat1, lon1, lat2, lon2, plat, plon)]

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