Create a buffer of n metres for non-projected 'geographical' spatial data

Description

Solves the problem that buffers will not be circular when used on non-projected data.

Usage

1
buff_geo(shp, width, ..., silent = TRUE)

Arguments

shp

A spatial object with a geographic CRS (WGS84) around which a buffer should be drawn

width

The distance (in metres) of the buffer

...

Arguments passed to rgeos::gBuffer()

silent

A binary value for printing the CRS details (default: FALSE)

Details

Returns a

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("routes_fast")
sp::proj4string(routes_fast) <- CRS("+init=epsg:4326")
buff <- buff_geo(routes_fast, width = 100)
plot(buff)
plot(routes_fast, add = TRUE)
# Test it works the same on projected data
shp <- spTransform(routes_fast, CRS("+init=epsg:27700"))
buff2 = buff_geo(shp, 50) # test if it works the same on projected data
plot(buff2)
plot(routes_fast, add = TRUE) # note they do not show
buff3 = spTransform(buff2, CRS("+init=epsg:4326"))
plot(buff)
plot(buff3, add = TRUE, col = "black")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.