| furdist | R Documentation |
For each point in x, compute the distance to the furthest location on the edge of the geometries in y. This is the counterpart of distance, which returns the distance to the nearest location.
The "edge" is the boundary of polygons, the line itself for lines, and the points for a points geometry.
## S4 method for signature 'SpatVector,SpatVector'
furdist(x, y, pairwise=FALSE, unit="m")
x |
SpatVector of points. The location(s) from which the distance is measured |
y |
SpatVector of points, lines, or polygons. The geometries whose furthest edge location is measured |
pairwise |
logical. If |
unit |
character. Can be either "m" or "km" |
If pairwise=TRUE a numeric vector with one distance for each pair. Otherwise a data.frame with columns "from" (the index of the point in x), "to" (the index of the geometry in y) and "distance".
distance, nearest, snapTo
# planar
crs <- "+proj=utm +zone=1"
p <- vect("POLYGON ((0 0, 8 0, 8 9, 0 9, 0 0))", crs=crs)
pts <- vect(cbind(c(1, 5), c(1, 5)), crs=crs)
furdist(pts, p)
furdist(pts, p, unit="km")
# longitude/latitude
pp <- vect("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))", crs="lonlat")
q <- vect(cbind(5, 5), crs="lonlat")
furdist(q, pp, unit="km")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.