Plot routing of subbasins for a HYPE model on an interactive map.
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 = ""
)
Returns an interactive Leaflet 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.
Integer, column index in the map
'data' slot
holding SUBIDs (sub-catchment IDs).
Only required if providing GeoData information with gd
.
Path to model GeoData.txt or a GeoData object from ReadGeoData
. Only required if map
does not contain SUBID and/or MAINDOWN fields.
Path to model BranchData.txt or a BranchData object from ReadBranchData
. Only required if model has a BranchData.txt file.
Logical, include a scale bar on the map.
Logical, if TRUE
, then a search bar will be included. See leaflet.extras::addSearchFeatures()
.
Numeric, weight of subbasin boundary lines. See leaflet::addPolygons()
.
Numeric, opacity of subbasin boundary lines. See leaflet::addPolygons()
.
String, color of subbasin polygons. See leaflet::addPolygons()
.
Numeric, opacity of subbasin polygons. See leaflet::addPolygons()
.
Numeric, weight of routing lines. See leaflet::addPolylines()
.
Numeric, opacity of routing lines. See leaflet::addPolylines()
.
Integer, seed number to to produce repeatable color palette.
Numeric specifying the amount of darkening applied to the random color palette. Negative values will lighten the palette. See distinctColorPalette
.
Numeric, font size (px) for map subbasin labels.
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.
Numeric, width of the exported map image in pixels. See webshot::webshot()
.
Numeric, height of the exported map image in pixels. See webshot::webshot()
.
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()
.
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
.
if (FALSE) {
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
)
}
Run the code above in your browser using DataLab