DOI-USGS / dataRetrieval

This R package is designed to obtain USGS or EPA water quality sample data, streamflow data, and metadata directly from web services.
https://doi-usgs.github.io/dataRetrieval/
Other
256 stars 85 forks source link

Need to escape WQP site IDs with spaces in them or NLDI queries. #677

Closed dblodgett-usgs closed 9 months ago

dblodgett-usgs commented 9 months ago

Describe the bug NLDI feature identifiers with spaces are not handled correctly.

I think just wrapping this line in utils::URLencode would fix it.

To Reproduce Steps to reproduce the behavior:

dataRetrieval::findNLDI(wqp = "CCU_EQL-2 H9")

Expected behavior

dataRetrieval::findNLDI(wqp = utils::URLencode("CCU_EQL-2 H9"))
#> $origin
#> Simple feature collection with 1 feature and 6 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -78.715 ymin: 33.913 xmax: -78.715 ymax: 33.913
#> Geodetic CRS:  WGS 84
#> # A tibble: 1 × 7
#>   sourceName        identifier comid name      X     Y         geometry
#>   <chr>             <chr>      <chr> <chr> <dbl> <dbl>      <POINT [°]>
#> 1 Water Quality Po… CCU_EQL-2… 9069… High… -78.7  33.9 (-78.715 33.913)

Created on 2023-10-03 with reprex v2.0.2