Skip to contents

Add a grid and add buffers on a map to assess the area of same land cover type.

Usage

add_grid(g = NULL, box = NULL, nx = NULL, n = 2)

Arguments

g

A ggplot objects on which to add the grid

box

A SpatExtent to get the box extent

nx

A number defining the grid interval in metre for x and y

n

A number to set the border of the grid from the edge of the plot

Value

A ggplot2 object

Examples

# Get station metadata
stn <- get_metadata_frost(stationid = 18700)

# Get coordinates and define boundary box
centre <- terra::crds(stn)
box <- make_bbox(centre, dx = 1600)

# Plot map tile
g <- plot_tile_station(stn, box, tile_name = "ortofoto")
#> Error in png::readPNG(resp): libpng error: Not a PNG file

# Add grid and buffer
nx <- 200
n <- 2
g <- add_grid(g, box, nx, n)
#> Error: object 'g' not found
g <- add_buffer(g, centre, 300, 1000, nx, n)
#> Error: object 'g' not found
g
#> Error: object 'g' not found