Functions that set, view and get a session-wide area of interest (AOI) that can be used by all getSpatialData functions.

set_aoi(aoi)

view_aoi(aoi = NULL, aoi_colour = "deepskyblue", ...)

get_aoi(type = "sf")

Arguments

aoi

sfc_POLYGON or SpatialPolygons or matrix, representing a single multi-point (at least three points) polygon of your area-of-interest (AOI). If it is a matrix, it has to have two columns (longitude and latitude) and at least three rows (each row representing one corner coordinate). If its projection is not +proj=longlat +datum=WGS84 +no_defs, it is reprojected to the latter. If set_aoi is called and aoi is undefined, an interactve mapedit viewer should open letting you draw an AOI polygon.

aoi_colour

chracter, AOI colour.

...

deprecated arguments

type

character, AOI object type, either "matrix", "sf" or "sp".

Details

set_aoi defines a session AOI that is used for querying data within the running session (if no other AOI is provided with a query function call). If called without argument, an interactive mapedit viewer is opened letting you draw an AOI polygon. Otherwise, the function supports sf, sp or matrix objects as aoi input (see argument aoi).

view_aoi displays the defined session AOI on an interactive mapview/leaflet map.

get_aoi returns the defined session AOI.

See also

Author

Jakob Schwalb-Willmann

Examples


## set aoi (example aoi)
data("aoi_data")
set_aoi(aoi_data[[1]])
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()

if (FALSE) {
## draw aoi interactively
set_aoi() # just call without an argument

## view aoi
view_aoi()

## return aoi
aoi <- get_aoi(type = "sf")
}