Skip to contents

Provides a precanned leaflet layout for checking, and refining AOI queries. Useful leaflet tools allow for the marking of points, measuring of distances, and panning and zooming.

Usage

aoi_map(AOI = NULL, returnMap = FALSE)

Arguments

AOI

any spatial object (raster, sf, sp). Can be piped (%>%) from aoi_get. If AOI = NULL, base map of CONUS will be returned.

returnMap

logical. If FALSE (default) the input AOI is returned and the leaflet map printed. If TRUE the leaflet map is returned and printed.

Value

a leaflet html object

Examples

if (FALSE) {
## Generate an empty map:
aoi_map()

## Check a defined AOI:
AOI <- getAOI(clip = list("UCSB", 10, 10))
aoi_map(AOI)

## Chain to AOI calls:
getAOI(clip = list("UCSB", 10, 10)) %>% aoi_map()

## Add layers with standard leaflet functions:
r <- getAOI("UCSB") %>% # get AOI
  HydroData::findNWIS() # get SpatialPointsDataframe of local USGS gages

aoi_map(r$AOI) %>%
  addMarkers(data = r$nwis, popup = r$nwis$site_no)

## Save map for reference:
m <- getAOI("Kansas City") %>% aoi_map()
htmlwidgets::saveWidget(m, file = paste0(getwd(), "/myMap.html"))
}