DOI-USGS / nhdplusTools

See official repository at: https://code.usgs.gov/water/nhdplusTools
https://doi-usgs.github.io/nhdplusTools/
Creative Commons Zero v1.0 Universal
85 stars 33 forks source link

Client for new NLDI processing tool #210

Closed dblodgett-usgs closed 3 years ago

dblodgett-usgs commented 3 years ago

This is now available. https://labs.waterdata.usgs.gov/api/nldi/pygeoapi need to work up a client app.

dblodgett-usgs commented 3 years ago

Progress...

library(nhdplusTools)
#> USGS Support Package: https://owi.usgs.gov/R/packages.html#support

point <- sf::st_point(x = c(-89.2158, 42.9561), dim = "XY")

(trace <- get_raindrop_trace(point))
#> Simple feature collection with 2 features and 7 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -89.21572 ymin: 42.94986 xmax: -89.20944 ymax: 42.95699
#> Geodetic CRS:  WGS 84
#> # A tibble: 2 x 8
#>   id      gnis_name    comid reachcode raindropPathDist measure intersectionPoi~
#>   <chr>   <chr>        <int> <chr>                <dbl>   <dbl> <list>          
#> 1 downst~ Yahara Ri~  1.33e7 07090002~             239.    30.8 <dbl [2]>       
#> 2 raindr~ <NA>       NA      <NA>                   NA     NA   <dbl [0]>       
#> # ... with 1 more variable: geometry <LINESTRING [°]>

bbox <- sf::st_bbox(trace) + c(-0.005, -0.005, 0.005, 0.005)

nhdplusTools::plot_nhdplus(bbox = bbox)

plot(sf::st_transform(sf::st_sfc(point, crs = 4326), 3857), add = TRUE)
plot(sf::st_transform(sf::st_geometry(trace)[1], 3857), add = TRUE, col = "red")
plot(sf::st_transform(sf::st_geometry(trace)[2], 3857), add = TRUE, col = "black")

Created on 2021-08-11 by the reprex package (v2.0.0)