gr_buffer_geo | R Documentation |
Generate the buffer of spatial object in geographic coordinates. The function transforms the object into Azimuthal equidistant projection, then buffers it by the specified radius and then reprojects into geographical coordinate system (WGS84)
gr_buffer_geo(g, bufsize)
g |
|
bufsize |
Numeric value of a buffer distance, in meters. |
sf
or sfg
object, buffered to bufsize
and projected into geographic coordinates (WGS84).
if (require("sf")) {
library(grwat)
library(ggplot2)
path = system.file("extdata", "spas-zagorye.gpkg", package = "grwat")
basin = sf::st_read(path, layer = 'basin') # read basin region
basin_buffer = gr_buffer_geo(basin, 25000)
ggplot() +
geom_sf(data = basin_buffer, fill = 'orangered', color = 'black') +
geom_sf(data = basin, fill = 'steelblue', color = 'black')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.