diff --git a/_pkgdown.yml b/_pkgdown.yml index 1fe168d6..cc9b8dcb 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -6,6 +6,7 @@ reference: Functions that help get access data. (all U.S. context) - contents: - '`download_nhdplushr`' + - '`get_3dhp`' - '`get_nhdplus`' - '`get_nhdplushr`' - '`get_hr_data`' @@ -79,6 +80,7 @@ reference: desc: > Functions that make the package easier to work with. - contents: + - '`nhdplusTools_cache_settings`' - '`st_compatibalize`' - '`rename_geometry`' - '`align_nhdplus_names`' diff --git a/docs/404.html b/docs/404.html index 62ec9cf5..e2624806 100644 --- a/docs/404.html +++ b/docs/404.html @@ -39,7 +39,7 @@ nhdplusTools - 1.0.1 + 1.1.0 @@ -59,6 +59,9 @@
vignettes/get_3dhp_data.Rmd
+ get_3dhp_data.Rmd
This vignette shows how to work with a new +service based on data from the 3D Hydrography Program (3DHP) +released in 2024. 3DHP data uses “mainstem” identifiers as the primary +river ID. We’ll work with one for the Baraboo River in Wisconsin.
+We can find one to start with at a url like:
+https://reference.geoconnex.us/collections/mainstems/items?filter=name_at_outlet ILIKE '%Baraboo%'
This url searches the reference mainstem collection for rivers with
+names like “Baraboo”. Using that url query, we can find that the Baraboo
+mainstem ID is https://geoconnex.us/ref/mainstems/359842
+and that it flows to the Wisconsin and Mississippi
+https://geoconnex.us/ref/mainstems/323742
and
+https://geoconnex.us/ref/mainstems/312091
respectively. At
+the reference mainstem page, we can also find that the outlet NHDPlusV2
+COMID is
+https://geoconnex.us/nhdplusv2/comid/937070225
.
The code block just below generates starting locations based on +information derived from the reference mainstem for the Baraboo and a +point location near the Baraboo’s outlet. It queries the 3DHP service +for a flowline within a 10m buffer of the point specified just to get us +started.
+
+
+ comid <- "937070225"
+
+ point <- c(-89.441, 43.487) |>
+ sf::st_point() |>
+ sf::st_sfc(crs = 4326) |> sf::st_sf()
+
+ dm <- c('https://geoconnex.us/ref/mainstems/323742',
+ 'https://geoconnex.us/ref/mainstems/312091')
+
+ flowline <- get_3dhp(point, type = "flowline", buffer = 10)
+
+ mapview::mapview(list(point, flowline))
Now, we can use dataRetrieval +to retrieve a basin upstream of this outlet location. We specify the +NHDPlusV2 comid here since we know it, but could have used the point +location just as well.
+With the basin pulled from the findNLDI()
+function, we can pass it to get_3dhp()
as a Area of
+Interest for flowlines, waterbodies, and hydrolocations. We can then use
+the mainstem ids of our two downstream mainstem rivers found above to
+get the downtream mainstem rivers.
+
+ network <- get_3dhp(basin$basin, type = "flowline")
+#> Getting features 0 to 2000 of 6842
+#> Getting features 2000 to 4000 of 6842
+#> Getting features 4000 to 6000 of 6842
+#> Getting features 6000 to 6842 of 6842
+ water <- get_3dhp(basin$basin, type = "waterbody")
+#> Getting features 0 to 2000 of 3382
+#> Getting features 2000 to 3382 of 3382
+ hydrolocation <- get_3dhp(basin$basin, type = "hydrolocation")
+#> Warning in (function (AOI = NULL, ids = NULL, type = NULL, where = NULL, :
+#> sink, spring, waterbody outlet features found but were outside area of interest
+#> polygon.
+#> Warning: No sink, spring, waterbody outlet features found
+#> Warning: No headwater, terminus, divergence, confluence, catchment outlet
+#> features found in area of interest.
+#> Getting features 0 to 2000 of 7006
+#> Getting features 2000 to 4000 of 7006
+#> Getting features 4000 to 6000 of 7006
+#> Getting features 6000 to 7006 of 7006
+
+ down_mains <- get_3dhp(ids = dm, type = "flowline")
+#> Getting features 0 to 2000 of 3034
+#> Getting features 2000 to 3034 of 3034
+
+ map_data <- list(outlet = basin$origin,
+ basin = basin$basin,
+ flowline = network,
+ waterbody = water,
+ hydrolocation = hydrolocation,
+ down_mains = down_mains)
+
+ mapview::mapview(map_data)