Learn R Programming

cartography (version 1.4.1)

getOuterBorders: Extract SpatialPolygonsDataFrame Outer Borders

Description

Extract outer borders between SpatialPolygonsDataFrame units. Outer borders are non-contiguous SpatialPolygonsDataFrame borders (e.g. maritim borders).

Usage

getOuterBorders(spdf, spdfid = NULL, res = NULL, width = NULL)

Arguments

spdf
a SpatialPolygonsDataFrame.
spdfid
identifier field in spdf, default to the first column of the spdf data frame. (optional)
res
resolution of the grid used to compute borders (in spdf units). A high resolution will give more detailed borders. (optional)
width
maximum distance between used to compute borders (in spdf units). A higher width will build borders between units that are farther apart. (optional)

Value

A SpatialLinesDataFrame of borders is returned. This object has three id fields: id, id1 and id2. id1 and id2 are ids of units that neighbour a border; id is the concatenation of id1 and id2 (with "_" as separator).

See Also

discLayer, getBorders

Examples

Run this code
## Not run: 
# data(nuts2006)
# # Get units borders
# nuts0.outer <- getOuterBorders(nuts0.spdf)
# # Plot Countries
# plot(nuts0.spdf, border = NA, col = "grey60")
# # Plot borders
# plot(nuts0.outer, col = sample(x = rainbow(nrow(nuts0.outer))), 
#      lwd = 3, add = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab