Select neighbouring locations of a given origin

get_neighbours(origin, candidates, d_limit = Inf)

Arguments

origin

A numeric vector of length two containing respectively the longitude and latitude coordinate of the origin location.

candidates

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.

d_limit

Upper distance limit (as-the-crow-flies) in meters to consider a candidate location as a neighbour of the origin. Defaults to Inf, meaning that each candidate location will be a neighbour.

Value

A subset of candidates.

Note

Coordinates should be expressed in coordinate reference system EPSG:4326. The function assumes this to be true, and does not check for it.