get_nearest_neighbour.Rd
Find the nearest neighbour to a given origin
get_nearest_neighbour(origin, candidates)
A numeric vector of length two containing respectively the longitude and latitude coordinate of the origin location.
A data.frame
or similar representing the
set of possible neighbour locations to choose from. Should have only three
columns, with the first column containing unique indices for each location,
and the second and third column containing respectively the longitude and
latitude coordinates of each location.
A list of length two with element idx containing the index of the nearest neighbour and element dist containing the distance to it.
Coordinates should be expressed in coordinate reference system EPSG:4326. The function assumes this to be true, and does not check for it.