polyAtBorder: Indicate Polygons at the Border

Description Usage Arguments Value Author(s) Examples

Description

Determines which polygons of a "SpatialPolygons" object are at the border, i.e. have coordinates in common with the spatial union of all polygons (constructed using unionSpatialPolygons).

Usage

1
2
polyAtBorder(SpP, snap = sqrt(.Machine$double.eps),
             method = "rgeos", ...)

Arguments

SpP

an object of class "SpatialPolygons".

snap

tolerance used to consider coordinates as identical.

method

method to use for unionSpatialPolygons. Defaults to "rgeos", since polyclip uses integer arithmetic, which causes rounding errors usually requiring tuning of (i.e., increasing) the tolerance parameter snap (see example below).

...

further arguments passed to the chosen method.

Value

logical vector of the same length as SpP also inheriting its row.names.

Author(s)

Sebastian Meyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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("rgeos")) {
    atBorder <- polyAtBorder(districtsD, method = "rgeos")
    plot(districtsD, col = 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")
    plot(districtsD, col = atBorder)
}


Search within the surveillance package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.