Learn R Programming

grwat (version 0.0.4)

gr_buffer_geo: Quasi-geographic buffering

Description

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)

Usage

gr_buffer_geo(g, bufsize)

Value

sf or sfg object, buffered to bufsize and projected into geographic coordinates (WGS84).

Arguments

g

sf or sfg object with known coordinate system.

bufsize

Numeric value of a buffer distance, in meters.

Examples

Run this code
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')

}

Run the code above in your browser using DataLab