From 637d6e7884192ec3a3320882b3417541a414105e Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Thu, 12 Dec 2024 14:15:10 -0600 Subject: [PATCH 1/3] update labs nldi links to api.water --- demo/index.Rmd | 6 +++--- demo/index.html | 20 +++++++++---------- namespaces/nhdplusv2/comid.csv | 2 +- .../nhdplusv2/huc12pp/huc12pourpoints.csv | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/demo/index.Rmd b/demo/index.Rmd index ec88aa94..f60b46e4 100644 --- a/demo/index.Rmd +++ b/demo/index.Rmd @@ -397,9 +397,9 @@ geom_site <- sf::read_sf("https://geoconnex.us/nmwdi/nmbgmr/wells/NM0028827") point <- sf::st_sfc(geom_site$geometry) geom_site <- geom_site$geometry[[1]] nldi_point<-nhdplusTools::discover_nhdplus_id(point) -# nldiURL<-"DM = "https://labs.waterdata.usgs.gov/api/nldi/linked-data/nwissite/USGS-08279500/navigate/DM?distance=100" +# nldiURL<-"DM = "https://api.water.usgs.gov/nldi/linked-data/nwissite/USGS-08279500/navigate/DM?distance=100" -nldi_query <- URLencode(paste0('https://labs.waterdata.usgs.gov/api/nldi/linked-data/comid/position?f=json&coords=POINT(',geom_site[1],' ',geom_site[2],')')) +nldi_query <- URLencode(paste0('https://api.water.usgs.gov/nldi/linked-data/comid/position?f=json&coords=POINT(',geom_site[1],' ',geom_site[2],')')) start <- sf::read_sf(nldi_query) mainstem <- sf::read_sf(paste0(start$navigation,"/DM/flowlines?distance=250")) @@ -412,7 +412,7 @@ mapview::mapview(list("Downstream Mainstem"=sf::st_as_sf(sf::st_geometry(mainste The above code constructs the URLs to call the NLDI service directly, however there are convenience tools in [R](https://usgs-r.github.io/nhdplusTools/index.html) and [Python](https://github.com/cheginit/pynhd) to interact with the NLDI. Below we use the R package `nhdplusTools` to discover data indexed to our downstream mainstem in the NLDI. What features are available from the NLDI? ```{r, message=FALSE, warning=FALSE} -knitr::kable(fromJSON("https://labs.waterdata.usgs.gov/api/nldi/linked-data")) +knitr::kable(fromJSON("https://api.water.usgs.gov/nldi/linked-data/")) ``` diff --git a/demo/index.html b/demo/index.html index a6cc203c..d184a7dd 100644 --- a/demo/index.html +++ b/demo/index.html @@ -7992,9 +7992,9 @@

Complementary Tools - the NLDI and API Clients

point <- sf::st_sfc(geom_site$geometry) geom_site <- geom_site$geometry[[1]] nldi_point<-nhdplusTools::discover_nhdplus_id(point) -# nldiURL<-"DM = "https://labs.waterdata.usgs.gov/api/nldi/linked-data/nwissite/USGS-08279500/navigate/DM?distance=100" +# nldiURL<-"DM = "https://water.usgs.gov/nldi/linked-data/nwissite/USGS-08279500/navigate/DM?distance=100" -nldi_query <- URLencode(paste0('https://labs.waterdata.usgs.gov/api/nldi/linked-data/comid/position?f=json&coords=POINT(',geom_site[1],' ',geom_site[2],')')) +nldi_query <- URLencode(paste0('https://water.usgs.gov/nldi/linked-data/comid/position?f=json&coords=POINT(',geom_site[1],' ',geom_site[2],')')) start <- sf::read_sf(nldi_query) mainstem <- sf::read_sf(paste0(start$navigation,"/DM/flowlines?distance=250")) @@ -8003,7 +8003,7 @@

Complementary Tools - the NLDI and API Clients

mapview::mapview(list("Downstream Mainstem"=sf::st_as_sf(sf::st_geometry(mainstem)[within_hu08_13060001$HUC8,])), hcl.colors="blue")

The above code constructs the URLs to call the NLDI service directly, however there are convenience tools in R and Python to interact with the NLDI. Below we use the R package nhdplusTools to discover data indexed to our downstream mainstem in the NLDI. What features are available from the NLDI?

-
knitr::kable(fromJSON("https://labs.waterdata.usgs.gov/api/nldi/linked-data"))
+
knitr::kable(fromJSON("https://water.usgs.gov/nldi/linked-data"))
@@ -8016,27 +8016,27 @@

Complementary Tools - the NLDI and API Clients

- + - + - + - + - +
comid NHDPlus comidhttps://labs.waterdata.usgs.gov/api/nldi/linked-data/comidhttps://water.usgs.gov/nldi/linked-data/comid
huc12pp HUC12 Pour Pointshttps://labs.waterdata.usgs.gov/api/nldi/linked-data/huc12pphttps://water.usgs.gov/nldi/linked-data/huc12pp
nwissite NWIS Siteshttps://labs.waterdata.usgs.gov/api/nldi/linked-data/nwissitehttps://water.usgs.gov/nldi/linked-data/nwissite
wade Water Data Exchange 2.0 Siteshttps://labs.waterdata.usgs.gov/api/nldi/linked-data/wadehttps://water.usgs.gov/nldi/linked-data/wade
WQP Water Quality Portalhttps://labs.waterdata.usgs.gov/api/nldi/linked-data/wqphttps://water.usgs.gov/nldi/linked-data/wqp
@@ -8059,7 +8059,7 @@

Complementary Tools - the NLDI and API Clients

col.regions = c("white","orange","darkgreen") )
- +
map <- mapview::mapview(list("Pecos Headwaters"=convert(within_hu08_13060001$HUC8)), col.regions=c("green"), alpha.regions=0.1) +
 mapview::mapview(list("Las Vegas NPDES Points"=convert(npdes)), col.regions="red") + mapview::mapview(list("Las Vegas PWS"=convert(lv)), col.regions="black") +
 mapview::mapview(list("Downstream Mainstem"=sf::st_as_sf(sf::st_geometry(mainstem)[within_hu08_13060001$HUC8,])), hcl.colors="blue")  +
@@ -8077,7 +8077,7 @@ 

Complementary Tools - the NLDI and API Clients

map@map %>% leaflet::setView(lng=x, lat=y, zoom=14)
- +

Browsing around some of the sites available, we see a few: