diff --git a/R/readWQPdots.R b/R/readWQPdots.R index 943d1465..53382a05 100644 --- a/R/readWQPdots.R +++ b/R/readWQPdots.R @@ -48,7 +48,7 @@ readWQPdots <- function(..., legacy = FALSE) { bbox <- "bBox" %in% names(matchReturn) if(bbox){ - values_bbox <- sapply(matchReturn["bBox"], function(x) as.character(paste0(eval(x), collapse = ";"))) + values_bbox <- sapply(matchReturn["bBox"], function(x) as.character(paste0(eval(x), collapse = ","))) matchReturn <- matchReturn[names(matchReturn) != "bBox"] } diff --git a/R/whatWQPdata.R b/R/whatWQPdata.R index d241b167..cb669be4 100644 --- a/R/whatWQPdata.R +++ b/R/whatWQPdata.R @@ -161,6 +161,10 @@ whatWQPmetrics <- function(..., #' siteType = "Lake, Reservoir, Impoundment", #' countycode = "US:55:025", convertType = FALSE) #' } +#' +#' bbox <- c(-86.9736, 34.4883, -86.6135, 34.6562) +#' what_bb <- whatWQPdata(bBox = bbox) +#' whatWQPdata <- function(..., saveFile = tempfile(), convertType = TRUE) { values <- readWQPdots(..., legacy = TRUE) diff --git a/man/whatWQPdata.Rd b/man/whatWQPdata.Rd index a9be4bd6..65a4adf6 100644 --- a/man/whatWQPdata.Rd +++ b/man/whatWQPdata.Rd @@ -57,6 +57,9 @@ lakeSites_chars <- whatWQPdata( siteType = "Lake, Reservoir, Impoundment", countycode = "US:55:025", convertType = FALSE) } + +bbox <- c(-86.9736, 34.4883, -86.6135, 34.6562) +what_bb <- whatWQPdata(bBox = bbox) \dontshow{\}) # examplesIf} } \seealso{ diff --git a/tests/testthat/tests_general.R b/tests/testthat/tests_general.R index 2a743082..6922e9cf 100644 --- a/tests/testthat/tests_general.R +++ b/tests/testthat/tests_general.R @@ -355,7 +355,7 @@ test_that("readWQPdots working", { # bbox vector turned into single string with coords separated by semicolons formArgs_bbox <- dataRetrieval:::readWQPdots(bbox = c(-92.5, 45.4, -87, 47)) expect_true(length(formArgs_bbox) == 2) - expect_true(length(gregexpr(";", formArgs_bbox)[[1]]) == 3) + expect_true(length(gregexpr(",", formArgs_bbox)[[1]]) == 3) # NWIS names (siteNumber) converted to WQP expected names (siteid) formArgs_site <- dataRetrieval:::readWQPdots(siteNumber = "04010301") @@ -368,6 +368,26 @@ test_that("readWQPdots working", { expect_true(length(formArgs$values) == 2) expect_true("statecode" %in% names(formArgs$values)) expect_false("stateCd" %in% names(formArgs$values)) + + bbox <- c(-86.97361, 34.48827, -86.61349, 34.65623) + what_bbox <- whatWQPdata(bBox = bbox) + expect_true(nrow(what_bbox) > 0) + x <- whatWQPsites(bBox = bbox) + expect_true(nrow(x) > 0) + df <- readWQPdata(bBox = bbox, + characteristicName = "Total Coliform", + startDateLo = "2023-01-01", + startDateHi = "2023-12-31", + service = "ResultWQX3", + dataProfile = "narrow") + expect_true(nrow(df) > 0) + df_legacy <- readWQPdata(bBox = bbox, + characteristicName = "Total Coliform", + startDateLo = "2023-01-01", + startDateHi = "2023-12-31", + service = "Result", + dataProfile = "narrowResult") + expect_true(nrow(df_legacy) > 0) })