getBorders: Extract SpatialPolygonsDataFrame Borders

Description Usage Arguments Value Note See Also Examples

View source: R/getBorders.R

Description

Extract borders between SpatialPolygonsDataFrame units.

Usage

1
getBorders(spdf, spdfid = NULL)

Arguments

spdf

a SpatialPolygonsDataFrame. This SpatialPolygonsDataFrame has to be projected (planar coordinates).

spdfid

identifier field in spdf, default to the first column of the spdf data frame. (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).

Note

getBorders and getOuterBorders can be combined with rbind.

See Also

discLayer, getOuterBorders

Examples

1
2
3
4
5
6
7
8
9
data(nuts2006)
# Get units borders
nuts0.contig.spdf <- getBorders(nuts0.spdf)
# Plot Countries
plot(nuts0.spdf, border = NA, col = "grey60")
# Plot borders
plot(nuts0.contig.spdf, 
     col = sample(x = rainbow(nrow(nuts0.contig.spdf))), 
     lwd = 3, add = TRUE)

cartography documentation built on May 30, 2017, 4:18 a.m.

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