hydrogeofetch (hydrologic geospatial fabric extraction tool chain) is
the renamed successor to nhdplusTools. The package scope has grown
beyond NHDPlus, and the new name reflects that broader role. All
functions, signatures, and behavior carry over unchanged.
nhdplusTools will remain on CRAN as a deprecation shim forwarding
calls to hydrogeofetch until October 2028, at which point it will
be archived. Archived packages stay installable from the CRAN archive,
so code pinned to nhdplusTools will continue to run.
Indexing, network navigation, and network attribute functions have moved to hydroloom. hydrogeofetch is now focused on data access and NHD-specific preparation; hydroloom handles the general-purpose network analysis that was previously bundled here.
If you use any of the following, you now need library(hydroloom):
- Indexing (
get_flowline_index,get_waterbody_index,disambiguate_flowline_indexes) →hydroloom::index_points_to_lines(),index_points_to_waterbodies(),disambiguate_indexes() - Navigation (
get_UT,get_DM,get_UM,get_DD,navigate_network) →hydroloom::navigate_hydro_network() - Network attributes (
get_streamorder,get_levelpaths,get_pathlength,calculate_total_drainage_area, etc.) → hydroloom’sadd_streamorder(),add_levelpaths(),add_pathlength(),accumulate_downstream()
The typical workflow is now: use hydrogeofetch to fetch and prepare NHD
data, then hand off to hydroloom for indexing, navigation, and network
analysis. See vignette("migrating_from_nhdplusTools") for a complete
mapping of old to new function names.
Blodgett, D. 2026, hydrogeofetch: Hydrologic Geospatial Fabric Data Extraction Tool Chain, https://doi.org/10.5066/P13UWPUR
install.packages("nhdplusTools")For the latest development:
install.packages("remotes")
remotes::install_github("DOI-USGS/nhdplusTools")For data discovery and access in a U.S. context, start with the Getting Started page.
Detailed documentation of all the package functions can be found at the Reference page.
hydrogeofetch provides easy access to data associated with the U.S.
National Hydrography Dataset. Network analysis and spatial indexing live
in hydroloom.
The hydrogeofetch package provides tools to discover, download,
subset, and prepare U.S. NHDPlus data. Network analysis (navigation,
indexing, attribute generation) belongs in
hydroloom.
General, globally applicable functionality has been moved to
hydroloom.
hydrogeofetch implements a data model consistent with both the
NHDPlus
dataset and the
HY_Features data model.
The package aims to provide a set of tools that can be used to build
workflows using NHDPlus data.
This vision is intended as a guide to contributors – conveying what kinds of contributions are of interest to the package’s long term vision. It is a reflection of the current thinking and is open to discussion and modification.
The following describe a vision for the functionality that should be included in the package in the long run.
The NHDPlus is a very large dataset both spatially and in terms of the number of attributes it contains. Subsetting utilities will provide network location discovery, network navigation, and data export utilities to generate spatial and attribute subsets of the NHDPlus dataset.
Indexing data to the hydrographic network (linear referencing and
catchment indexing) is handled by
hydroloom. hydrogeofetch
provides the data access needed to set up indexing workflows.
Given that hydrogeofetch is focused on working with NHDPlus data, the
NHDPlus data model will largely govern the data model the package is
designed to work with. That said, much of the package functionality also
uses concepts from the HY_Features standard.
Note: The HY_Features standard is based on the notion that a “catchment” is a holistic feature that can be “realized” (some might say modeled) in a number of ways. In other words, a catchment can only be characterized fully through a collection of different conceptual representations. In NHDPlus, the “catchment” feature is the polygon feature that describes the drainage divide around the hydrologic unit that contributes surface flow to a given NHD flowline. While this may seem like a significant difference, in reality, the NHDPlus COMID identifier lends itself very well to the HY_Features catchment concept. The COMID is used as an identifier for the catchment polygon, the flowline that connects the catchment inlet and outlet, and value added attributes that describe characteristics of the catchment’s interior. In this way, the COMID identifier is actually an identifier for a collection of data that together fully describe an NHDPlus catchment. See the NHDPlus mapping to HY_Features in the HY_Features specification.
Below is a description of the scope of data used by the hydrogeofetch
package. While other data and attributes may come into scope, it should
only be done as a naive pass-through, as in data subsetting, or with
considerable deliberation.
Flowline geometry is a mix of 1-d streams and 1-d “artificial paths”. In order to complete the set of features meant to represent water, we need to include waterbody polygons.
Catchment polygons are the result of a complete elevation derived hydrography process with hydro-enforcement applied with both Watershed Boundary Dataset Hydrologic Units and NHD reaches.
The NHDPlus includes numerous attributes that are built using the network and allow a wide array of capabilities that would require excessive iteration or sophisticated and complex graph-oriented data structures and algorithms.
The NHDPlus is a very large dataset. The architecture of this package as it relates to handling data and what dependencies are used will be very important.
hydrogeofetch offers a mix of web service and local data
functionality. Web services have generally been avoided for large
processes. However, applications that would require loading significant
amounts of data to perform something that can be accomplished with a web
service very quickly are supported. Systems like the Network Linked
Data Index are used for
data discovery.
Initial package development focused on the National Seamless NHDPlus database. NHDPlus High Resolution is also supported.
https://github.com/mbtyers/riverdist
https://github.com/jsta/nhdR
https://github.com/lawinslow/hydrolinks
https://github.com/mikejohnson51/HydroData
https://github.com/ropensci/FedData
https://github.com/hyriver/pygeohydro … others – please suggest
additions?
Development happens on GitHub (doi-usgs/nhdplusTools). Official builds and release candidates are produced on code.usgs.gov (code.usgs.gov/water/nhdplusTools) using GitLab CI.
Vignettes use the BUILD_VIGNETTES environment variable to control
code evaluation. Set BUILD_VIGNETTES=TRUE in a local .Renviron to
build vignettes with live code. Without it, vignettes render with static
output only. An additional BUILD_VIGNETTES_CRAN=TRUE variable controls
image size in the drainage area vignette.
Local development does not require building the source package. Use
devtools::test(), devtools::check(), and devtools::document()
directly.
Release candidates are built on code.usgs.gov. Push a branch named
rc/<version> (e.g. rc/2.0.0) to trigger the GitLab CI pipeline,
which runs three stages:
- check – lightweight structural check (no tests, no examples, no vignettes). Gates the rest of the pipeline.
- build –
R CMD build .to produce the source tarball. Uploads the tarball to the GitLab generic package registry. - verify –
R CMD check --as-cranon the built tarball.
Once the pipeline passes, download the tarball from the package registry
and submit it to CRAN. The tarball that CRAN receives is the exact
artifact that passed --as-cran in CI.
- All checks pass and code coverage is adequate
- NEWS.md is up to date
- Disclaimer is in released form
- Version updated in inst/CITATION and code.json
- Push
rc/<version>branch to code.usgs.gov and confirm pipeline passes - Download tarball from GitLab package registry and submit to CRAN
- After CRAN acceptance:
- Ensure pkgdown is up to date
- Commit, push, and PR/MR changes
- Create release page and tag
- Attach CRAN tar.gz to release page
- Update DOI to point to release page
- Switch README disclaimer back to “dev” mode
- Bump version in DESCRIPTION
First, thanks for considering a contribution! I hope to make this package a community created resource for us all to gain from and won’t be able to do that without your help!
- Contributions should be thoroughly tested with
testthat. - Code style should attempt to follow the
tidyversestyle guide. - Please attempt to describe what you want to do prior to contributing by submitting an issue.
- Please follow the typical github fork - pull-request workflow.
- Make sure you use roxygen and run Check before contributing. More on this front as the package matures.
Other notes: - consider running lintr prior to contributing. -
consider running goodpractice::gp() on the package before
contributing. - consider running devtools::spell_check() if you wrote
documentation. - this package uses pkgdown. Running
pkgdown::build_site() will refresh it.
This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

