map_nhdplus: Make Interactive Map of NHDPlus

View source: R/map_nhdplus.R

map_nhdplusR Documentation

Make Interactive Map of NHDPlus

Description

Given a list of outlets, get their basin boundaries and network and return a leaflet map in EPSG:4326.

Usage

map_nhdplus(
  outlets = NULL,
  bbox = NULL,
  streamorder = NULL,
  nhdplus_data = NULL,
  gpkg = NULL,
  flowline_only = NULL,
  plot_config = NULL,
  overwrite = TRUE,
  cache_data = NULL,
  return_map = FALSE
)

Arguments

outlets

list of nldi outlets. Other inputs are coerced into nldi outlets, see details.

bbox

object of class bbox with a defined crs. See examples.

streamorder

integer only streams of order greater than or equal will be returned

nhdplus_data

geopackage containing source nhdplus data (omit to download)

gpkg

path and file with .gpkg ending. If omitted, no file is written.

flowline_only

boolean only subset and plot flowlines only, default=FALSE

plot_config

list containing plot configuration, see details.

overwrite

passed on the subset_nhdplus.

cache_data

character path to rds file where all plot data can be cached. If file doesn't exist, it will be created. If set to FALSE, all caching will be turned off – this includes basemap tiles.

return_map

if FALSE (default), a data.frame of plot data is returned invisibly in NAD83 Lat/Lon, if TRUE the leaflet object is returned

Details

map_nhdplus supports several input specifications. An unexported function "as_outlet" is used to convert the outlet formats as described below.

  1. if outlets is omitted, the bbox input is required and all nhdplus data in the bounding box is plotted.

  2. If outlets is a list of integers, it is assumed to be NHDPlus IDs (comids) and all upstream tributaries are plotted.

  3. if outlets is an integer vector, it is assumed to be all NHDPlus IDs (comids) that should be plotted. Allows custom filtering.

  4. If outlets is a character vector, it is assumed to be NWIS site ids.

  5. if outlets is a list containing only characters, it is assumed to be a list of nldi features and all upstream tributaries are plotted.

  6. if outlets is a data.frame with point geometry, a point in polygon match is performed and upstream with tributaries from the identified catchments is plotted.

See plot_nhdplus for details on plot configuration.

Value

data.frame or leaflet map (see return_map)

Examples


map_nhdplus("05428500")

map_nhdplus("05428500", streamorder = 2)

map_nhdplus(list(13293970, 13293750))

source(system.file("extdata/sample_data.R", package = "nhdplusTools"))

map_nhdplus(list(13293970, 13293750), streamorder = 3, nhdplus_data = sample_data)

#return leaflet object
map_nhdplus("05428500", return_map = TRUE)


nhdplusTools documentation built on June 22, 2024, 10:36 a.m.