Learn R Programming

stplanr (version 1.2.2)

geo_buffer: Perform a buffer operation on a temporary projected CRS

Description

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

Usage

geo_buffer(shp, dist = NULL, width = NULL, ...)

Arguments

shp

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

dist

The distance (in metres) of the buffer (when buffering simple features)

width

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

...

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

Details

Requires recent version of PROJ (>= 6.3.0). Buffers on sf objects with geographic (lon/lat) coordinates can also be done with the s2 package.

See Also

Other geo: bbox_scale(), bind_sf(), geo_bb(), geo_bb_matrix(), geo_length(), geo_projected(), geo_select_aeq(), quadrant()

Examples

Run this code
lib_versions <- sf::sf_extSoftVersion()
lib_versions
if (lib_versions[3] >= "6.3.1") {
  buff_sf <- geo_buffer(routes_fast_sf, dist = 50)
  plot(buff_sf$geometry)
  geo_buffer(routes_fast_sf$geometry, dist = 50)
}

Run the code above in your browser using DataLab