buff_geo: Create a buffer of n metres for non-projected 'geographical'...

Description Usage Arguments Details Examples

View source: R/toptail.R

Description

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

Usage

1

Arguments

shp

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

width

The distance (in metres) of the buffer (when buffering sp objects)

...

Arguments passed to the buffer (see ?rgeos::gBuffer or ?sf::st_buffer for details)

Details

Returns a

Examples

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

stplanr documentation built on May 19, 2018, 5:04 p.m.