getOuterBorders: Extract Polygons Outer Borders

Description Usage Arguments Value Note See Also Examples

View source: R/getOuterBorders.R

Description

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

Usage

1
getOuterBorders(x, id, res = NULL, width = NULL, spdf, spdfid = NULL)

Arguments

x

an sf object, a simple feature collection or a SpatialPolygonsDataFrame.

id

identifier field in x, default to the first column. (optional)

res

resolution of the grid used to compute borders (in x units). A high resolution will give more detailed borders. (optional)

width

maximum distance between used to compute borders (in x units). A higher width will build borders between units that are farther apart. (optional)

spdf

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

spdfid

deprecated, identifier field in spdf, default to the first column of the spdf data frame. (optional)

Value

An sf object (MULTILINESTRING) 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, getBorders

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mtq <- st_read(system.file("shape/martinique.shp", package="cartography"))
# Get units borders
mtq.outer <- getOuterBorders(x = mtq, res = 1000, width = 2500)
# Plot communesa
plot(mtq$geometry, col = "grey60")
# Plot borders
plot(mtq.outer, col = sample(x = rainbow(nrow(mtq.outer))),
     lwd = 3, add = TRUE)
     

data(nuts2006)
# Get units borders
nuts0.outer <- getOuterBorders(x = 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)

cartography documentation built on Sept. 25, 2017, 5:03 p.m.