buff_sp | R Documentation |
Creates buffer of sp polygon object. Intended to replace raster::buffer, which relies on rgeos
buff_sp(area, radius, dissolve = TRUE)
area |
SpatialPolygon or SpatialPolygonDataFrame that defines the area |
radius |
scaler for the size of the buffer (in whatever units the polygon is projected in) |
dissolve |
boolean (default TRUE), to dissolve into single object, or leave as multiple objects |
Under the hood, this converts sp objects into sf objects and uses st_buffer
.
When dissolve=TRUE
, it uses st_union(area)
and then buffers.
A SpatialPolygonDataFrame object (when dissolve=FALSE), or a SpatialPolygon object (when dissolve=TRUE)
library(sp) #for sp plot methods # large grid cells data(nyc_bor) res <- buff_sp(nyc_bor,7000) plot(nyc_bor) plot(res,border='BLUE',add=TRUE) # When dissolve=FALSE, still returns individual units # that can overlap res2 <- buff_sp(nyc_bor,7000,dissolve=FALSE) plot(res2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.