Provides a full feature network navigation function that will work with local or web service data. Parameter details provide context.
navigate_network(
start,
mode = "UM",
network = NULL,
output = "flowlines",
distance_km = 10,
trim_start = FALSE,
trim_stop = FALSE,
trim_tolerance = 5
)list, integer, sf, or sfc if list must be a valid NLDI feature if integer must be a valid comid. If sf, must contain a "comid" field.
character chosen from c(UM, DM, UT, or DD)
sf should be compatible with network navigation functions If NULL, network will be derived from requests to the NLDI
character flowline or a valid NLDI data source
numeric distance to navigate in km
logical should start be trimmed or include entire catchment?
logical should stop(s) be trimmed or include entire catchment(s)? # Not supported
numeric from 0 to 100 percent of flowline length. If amount to trim is less than this tolerance, no trim will be applied.
# \donttest{
navigate_network(list(featureSource = "nwissite", featureID = "USGS-06287800"),
"UM",
output = "flowlines",
trim_start = TRUE)
#> All intersections performed in latitude/longitude.
#> Reading NHDFlowline_Network
#> Writing NHDFlowline_Network
#> Simple feature collection with 8 features and 138 fields
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: -107.8101 ymin: 45.38484 xmax: -107.7487 ymax: 45.46047
#> Geodetic CRS: NAD83
#> # A tibble: 8 × 139
#> objectid comid fdate resolution gnis_id gnis_name lengthkm
#> * <int> <int> <dttm> <chr> <chr> <chr> <dbl>
#> 1 1338487 12781087 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 0.176
#> 2 1338488 12781093 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 1.26
#> 3 1338526 12781103 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 2.79
#> 4 1338528 12781107 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 1.42
#> 5 1338527 12781111 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 1.43
#> 6 1338529 12781115 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 1.44
#> 7 1338489 12781119 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 1.40
#> 8 1337173 12781125 2009-06-15 23:00:00 Medium 779903 Bighorn Riv… 0.836
#> # ℹ 132 more variables: reachcode <chr>, flowdir <chr>, wbareacomi <int>,
#> # ftype <chr>, fcode <int>, shape_length <dbl>, streamleve <dbl>,
#> # streamorde <dbl>, streamcalc <dbl>, fromnode <dbl>, tonode <dbl>,
#> # hydroseq <dbl>, levelpathi <dbl>, pathlength <dbl>, terminalpa <dbl>,
#> # arbolatesu <dbl>, divergence <dbl>, startflag <dbl>, terminalfl <dbl>,
#> # dnlevel <dbl>, uplevelpat <dbl>, uphydroseq <dbl>, dnlevelpat <dbl>,
#> # dnminorhyd <dbl>, dndraincou <dbl>, dnhydroseq <dbl>, frommeas <dbl>, …
# }
source(system.file("extdata", "walker_data.R", package = "nhdplusTools"))
hydro_location <- list(comid = 5329339,
reachcode = "18050005000078",
reach_meas = 30)
hydro_location <- sf::st_sf(
hydro_location,
geom = nhdplusTools::get_hydro_location(data.frame(hydro_location),
walker_flowline))
net <- navigate_network(hydro_location,
mode = "DM", network = walker_flowline,
trim_start = TRUE, distance_km = 20)
plot(sf::st_geometry(walker_flowline))
plot(sf::st_geometry(hydro_location), add = TRUE)
plot(sf::st_geometry(net), add = TRUE, col = "blue", lwd = 2)