polyAtBorder | R Documentation |
Determines which polygons of a "\linkSPclass{SpatialPolygons}"
object are at the border, i.e. have coordinates in common with the
spatial union of all polygons (constructed using
unionSpatialPolygons
).
polyAtBorder(SpP, snap = sqrt(.Machine$double.eps),
method = "sf", ...)
SpP |
an object of class |
snap |
tolerance used to consider coordinates as identical. |
method |
method to use for |
... |
further arguments passed to the chosen |
logical vector of the same length as SpP
also inheriting its
row.names
.
Sebastian Meyer
## Load districts of Germany
load(system.file("shapes", "districtsD.RData", package = "surveillance"))
## Determine districts at the border and check the result on the map
if (requireNamespace("sf")) {
atBorder <- polyAtBorder(districtsD, method = "sf")
if (interactive()) plot(districtsD, col = atBorder)
table(atBorder)
}
## For method = "polyclip", a higher snapping tolerance is required
## to obtain the correct result
if (requireNamespace("polyclip")) {
atBorder <- polyAtBorder(districtsD, snap = 1e-6, method = "polyclip")
if (interactive()) plot(districtsD, col = atBorder)
table(atBorder)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.