Skip to contents

Adjusts the area of interest to the nearest 100m. Note that this package assumes to data is in a metric equal area projection.

Usage

aoi_snap(aoi, method = c("expand", "shrink"))

Arguments

aoi

is a sf object (e.g. polygon). The bounding box of the shape will be used to create rectangular shape.

method

Options are shrink or expand. Shrink will snap the aoi in to the nearest 100m. Expand will snap the aoi out to the nearest 100m.

Value

a sf polygon

Details

This is an essential first step. As subsequent co-variate layers will be generated at multiple resolutions (e.g. 5, 10, 25m^2) and then disaggregate'd back to the lowest resolution. Having the aoi set 100m break-points facilitates this.

Examples

## Load sf object
aoi_raw <- sf::st_read(dsn = "../data/Block_aoi.gpkg", quiet = TRUE)
#> Error: Cannot open "../data/Block_aoi.gpkg"; The file doesn't seem to exist.
## snap aoi to nearest 100m
aoi_snap(aoi_raw)
#> Error in sf::st_bbox(aoi): object 'aoi_raw' not found
##
## [1] "initial extent is:"
## xmin      ymin      xmax      ymax
## 559691.2 5994955.0  560687.0 5995832.5
## [1] "Expanded extent is:"
## xmin    ymin    xmax    ymax
## 559600 5994900  560700 5995900