nearest_gridpoint {ztoolbox} | R Documentation |
Calculates nearest point on a grid to a reference point in longitude, latitude degree decimal.
nearest_gridpoint(lon, lat, grid, measure = c("euclidian","haversine"))
lon, lat |
longitude and latitude of the reference point in degrees decimal. |
grid |
matrix or data.frame with at leats two columns named |
measure |
method for distance calculation. Currently |
The distance of each point on grid
is calculated either as a euclidian distance, or with the Haversine Formula, which computes the great-circle distance between two points on a sphere.
An list with components:
idx |
index of the point nearest to coordinates |
lon |
longitude of reference point on |
lat |
latitude of reference point on |