PlotSubbasinRouting: Plot HYPE model subbasin routing.

View source: R/function_PlotSubbasinRouting.R

PlotSubbasinRoutingR Documentation

Plot HYPE model subbasin routing.

Description

Plot routing of subbasins for a HYPE model on an interactive map.

Usage

PlotSubbasinRouting(
  map,
  map.subid.column = 1,
  gd = NULL,
  bd = NULL,
  plot.scale = TRUE,
  plot.searchbar = FALSE,
  weight = 0.5,
  opacity = 1,
  fillColor = "#4d4d4d",
  fillOpacity = 0.25,
  line.weight = 5,
  line.opacity = 1,
  seed = NULL,
  darken = 0,
  font.size = 10,
  file = "",
  vwidth = 1424,
  vheight = 1000,
  html.name = ""
)

Arguments

map

Path to file containing subbasin polygon GIS data (e.g. shapefile or geopackage) or a SpatialPolygonsDataFrame or sf object. For large maps, a small/simplified polygon file should be used as larger files can take an excessive amount of time to render.

map.subid.column

Integer, column index in the map 'data' slot holding SUBIDs (sub-catchment IDs). Only required if providing GeoData information with gd.

gd

Path to model GeoData.txt or a GeoData object from ReadGeoData. Only required if map does not contain SUBID and/or MAINDOWN fields.

bd

Path to model BranchData.txt or a BranchData object from ReadBranchData. Only required if model has a BranchData.txt file.

plot.scale

Logical, include a scale bar on the map.

plot.searchbar

Logical, if TRUE, then a search bar will be included. See leaflet.extras::addSearchFeatures().

weight

Numeric, weight of subbasin boundary lines. See leaflet::addPolygons().

opacity

Numeric, opacity of subbasin boundary lines. See leaflet::addPolygons().

fillColor

String, color of subbasin polygons. See leaflet::addPolygons().

fillOpacity

Numeric, opacity of subbasin polygons. See leaflet::addPolygons().

line.weight

Numeric, weight of routing lines. See leaflet::addPolylines().

line.opacity

Numeric, opacity of routing lines. See leaflet::addPolylines().

seed

Integer, seed number to to produce repeatable color palette.

darken

Numeric specifying the amount of darkening applied to the random color palette. Negative values will lighten the palette. See distinctColorPalette.

font.size

Numeric, font size (px) for map subbasin labels.

file

Save map to an image file by specifying the path to the desired output file using this argument. File extension must be specified. See mapview::mapshot(). You may need to run webshot::install_phantomjs() the first time you save a map to an image file.

vwidth

Numeric, width of the exported map image in pixels. See webshot::webshot().

vheight

Numeric, height of the exported map image in pixels. See webshot::webshot().

html.name

Save map to an interactive HTML file by specifying the path to the desired output file using this argument. File extension must be specified. See htmlwidgets::saveWidget().

Details

PlotSubbasinRouting generates an interactive Leaflet map with lines indicating the routing of flow between subbasins. GeoData information only needs to be provided if the map GIS data does not include SUBID and/or MAINDOWN fields. BranchData information only needs to be provided if model has a BranchData.txt file. Subbasin routing lines are randomly assigned a color using distinctColorPalette.

Value

Returns an interactive Leaflet map.

Examples

## Not run: 
PlotSubbasinRouting(
  map = system.file("demo_model",
                    "gis", "Nytorp_map.gpkg",
                    package = "HYPEtools"
  ),
  gd = system.file("demo_model", "GeoData.txt", package = "HYPEtools"),
  map.subid.column = 25
)

## End(Not run)


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.