Skip to content

Commit

Permalink
wkt_parse egs: only run if sf installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jan 27, 2021
1 parent 17aa09c commit 933f235
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/wkt_parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#' 55.43241335888528,13.26349675655365 52.53991761181831))"
#' wkt <- gsub("\n", " ", wkt)
#'
#' if (requireNamespace("sf", quietly=TRUE)) {
#' # to a bounding box in wkt format
#' wkt_parse(wkt, geom_big = "bbox")
#'
Expand All @@ -49,6 +50,7 @@
#' wkt_parse(wkt, geom_big = "axe", 20)
#' wkt_parse(wkt, geom_big = "axe", 10)
#' wkt_parse(wkt, geom_big = "axe", 5)
#' }
wkt_parse <- function(wkt, geom_big, geom_size=40, geom_n=10) {
geometry_handler(wkt, geom_big, geom_size, geom_n, FALSE)
}
2 changes: 2 additions & 0 deletions man/wkt_parse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test-occ_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ test_that("geometry inputs work as expected", {
55.43241335888528,13.26349675655365 52.53991761181831))"
wkt <- gsub("\n", " ", wkt)

skip_if_not_installed("sf")

# if WKT too long, with 'geom_big=bbox': makes into bounding box
vcr::use_cassette("occ_data_geometry_dd", {
dd <- occ_data(geometry = wkt, geom_big = "bbox", limit = 30)
Expand All @@ -264,7 +266,6 @@ test_that("geometry inputs work as expected", {
"geometry is big, querying BBOX, then pruning results to polygon")

# use 'geom_big=axe'
skip_if_not_installed("sf")
vcr::use_cassette("occ_data_geometry_ee_gg", {
ee <- occ_data(geometry = wkt, geom_big = "axe", limit = 30)
## more calls
Expand Down

0 comments on commit 933f235

Please sign in to comment.