Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Imports:
glue (>= 1.6.0),
jsonlite (>= 1.6.0),
leaflet (>= 2.1.0),
leaflet.extras (>= 1.0.0),
purrr (>= 0.3),
readr (>= 2.1),
readxl (>= 1.4.0),
rlang (>= 1.0),
sf (>= 1.0),
tidyselect (>= 1.1.0),
xml2 (>= 1.3.0)
xml2 (>= 1.3.0),
htmltools
Suggests:
covr,
ggplot2,
Expand All @@ -61,7 +61,7 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Collate:
'bcdata-package.R'
'bcdc-get-citation.R'
Expand Down
15 changes: 12 additions & 3 deletions R/bcdc-web-services.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
#' }
#' @export
bcdc_query_geodata <- function(record, crs = 3005) {
if (!has_internet()) stop("No access to internet", call. = FALSE) # nocov
if (!has_internet()) {
stop("No access to internet", call. = FALSE)
} # nocov
UseMethod("bcdc_query_geodata")
}

Expand Down Expand Up @@ -227,7 +229,9 @@ bcdc_query_geodata.bcdc_record <- function(record, crs = 3005) {
#' @export
bcdc_preview <- function(record) {
# nocov start
if (!has_internet()) stop("No access to internet", call. = FALSE)
if (!has_internet()) {
stop("No access to internet", call. = FALSE)
}
UseMethod("bcdc_preview")
}

Expand Down Expand Up @@ -271,6 +275,11 @@ make_wms <- function(x) {
layer=pub%3A{x}"
)

legend_html <- htmltools::tags$div(
style = "padding: 10px; background: white;",
htmltools::tags$img(src = wms_legend, alt = "Legend")
)

leaflet::leaflet() %>%
leaflet::addProviderTiles(
leaflet::providers$CartoDB.Positron,
Expand All @@ -281,7 +290,7 @@ make_wms <- function(x) {
layers = glue::glue("pub:{x}"),
options = wms_options
) %>%
leaflet.extras::addWMSLegend(uri = wms_legend) %>%
leaflet::addControl(legend_html, position = "topright") %>%
leaflet::setView(lng = -126.5, lat = 54.5, zoom = 5)
} # nocov end

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-get-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ test_that("bcdc_get_data fails when no downloadable resources", {
test_that("bcdc_get_data fails when >1 resource not specified & noninteractive", {
skip_if_net_down()
skip_on_cran()
skip_if(interactive())
expect_error(
bcdc_get_data("21c72822-2502-4431-b9a2-92fc9401ef12"),
"The record you are trying to access appears to have more than one resource."
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-query-geodata-filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ test_that("a BCGW name works with filter", {
ret <- bcdc_query_geodata("WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW") %>%
filter(WITHIN(little_box)) %>%
collect()
expect_equal(nrow(ret), 367)

expect_gt(nrow(ret), 350)
expect_lt(nrow(ret), 400)
})

test_that("Using BBOX works", {
Expand Down
Loading