This function solves the problem that buffers will not be circular when used on non-projected data.
geo_buffer(shp, dist = NULL, width = NULL, ...)
| 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 |
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.
#> GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H #> "3.8.0" "3.0.4" "7.0.0" "true" "true"if(lib_versions[3] >= "6.3.1") { buff_sf <- geo_buffer(routes_fast_sf, dist = 50) plot(buff_sf$geometry, add = TRUE) geo_buffer(routes_fast_sf$geometry, dist = 50) # on legacy sp objects (not tested) buff_sp <- geo_buffer(routes_fast, width = 100) class(buff_sp) plot(buff_sp, col = "red") }#> Error in polypath(p_bind(x[[i]]), border = border[i], lty = lty[i], lwd = lwd[i], col = col[i], rule = rule): plot.new has not been called yet