View source: R/get_nhdplushr.R
make_standalone | R Documentation |
Cleans up and prepares NHDPlusHR regional data for use as complete NHDPlus data. The primary modification applied is to ensure that any flowpath that exits the domain is labeled as a terminal path and attributes are propagated upstream such that the domain is independently complete.
make_standalone(flowlines)
flowlines |
sf data.frame of NHDPlusHR flowlines. |
sf data.frame containing standalone network
library(dplyr)
library(sf)
source(system.file("extdata/nhdplushr_data.R", package = "nhdplusTools"))
(outlet <- filter(hr_data$NHDFlowline, Hydroseq == min(Hydroseq)))
nrow(filter(hr_data$NHDFlowline, TerminalPa == outlet$Hydroseq))
hr_data$NHDFlowline <- make_standalone(hr_data$NHDFlowline)
(outlet <- filter(hr_data$NHDFlowline, Hydroseq == min(Hydroseq)))
nrow(filter(hr_data$NHDFlowline, TerminalPa == outlet$Hydroseq))
source(system.file("extdata/nhdplushr_data.R", package = "nhdplusTools"))
# Remove mainstem and non-dendritic stuff.
subset <- filter(hr_data$NHDFlowline,
StreamLeve > min(hr_data$NHDFlowline$StreamLeve) &
StreamOrde == StreamCalc)
subset <- subset_nhdplus(subset$COMID, nhdplus_data = hr_gpkg)$NHDFlowline
plot(sf::st_geometry(hr_data$NHDFlowline))
flowline_mod <- make_standalone(subset)
terminals <- unique(flowline_mod$TerminalPa)
colors <- sample(hcl.colors(length(terminals), palette = "Zissou 1"))
for(i in 1:length(terminals)) {
fl <- flowline_mod[flowline_mod$TerminalPa == terminals[i], ]
plot(st_geometry(fl), col = colors[i], lwd = 2, add = TRUE)
}
ol <- filter(flowline_mod, TerminalFl == 1 & TerminalPa %in% terminals)
plot(st_geometry(ol), lwd = 2, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.