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


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

get_aoi(type = "sf")



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.


chracter, AOI colour.


deprecated arguments


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


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


## set aoi (example aoi)

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

## view aoi

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