aoi_map: Generate Leafet map and tool set for AOI

View source: R/aoi_map.R

aoi_mapR Documentation

Generate Leafet map and tool set for AOI

Description

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

## Not run: 
## 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"))

## End(Not run)

mikejohnson51/AOI documentation built on Nov. 22, 2023, 6:05 p.m.