autoclean | R Documentation |
Automatically clean a rivernetwork object
autoclean(rivernetwork, mouthseg, mouthvert, crs, dissolve = FALSE)
rivernetwork |
rivernetwork object from the riverdist package |
mouthseg |
integer |
mouthvert |
integer |
crs |
crs string or epsg code |
dissolve |
logical combine runs of segments with no other connections? |
## Not run: library(nhdR) library(sf) # Generate test dataset bbox <- data.frame(xmin = -73.33838, ymin = 41.35841, xmax = -73.14540, ymax = 41.48593) b0 <- sf::st_sfc(sf::st_polygon(list(rbind( c(bbox$xmin, bbox$ymin), c(bbox$xmax, bbox$ymin), c(bbox$xmax, bbox$ymax), c(bbox$xmin, bbox$ymax), c(bbox$xmin, bbox$ymin))))) sf::st_crs(b0) <- 4326 b0 <- st_transform(b0, sf::st_crs(nhdR::vpu_shp)) nhd <- nhd_plus_query(poly = b0, dsn = c("NHDFlowLine"))$sp$NHDFlowLine outlet_reach <- terminal_reaches(network = nhd, approve_all_dl = TRUE) outlet_point <- st_cast(st_line_sample(outlet_reach, sample = 1), "POINT") mouthseg <- which(nhd$COMID == outlet_reach$comid) res <- autoclean(nhd_rv, mouthseg, mouthvert, crs = st_crs(nhd)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.