diff --git a/DESCRIPTION b/DESCRIPTION index 79c2345..a373d53 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: wdpar Type: Package -Version: 1.3.3.2 +Version: 1.3.3.3 Title: Interface to the World Database on Protected Areas Description: Fetch and clean data from the World Database on Protected Areas (WDPA) and the World Database on Other Effective Area-Based diff --git a/NEWS.md b/NEWS.md index d4e3c75..e8c4ad7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# wdpar 1.3.3.3 + +- Improve error message for `wdpa_fetch()` when PhantomJS is not + installed (#63). + # wdpar 1.3.3.2 - Add URLs to README for citations (#58). diff --git a/R/wdpa_url.R b/R/wdpa_url.R index c98ec5c..2b8eb46 100644 --- a/R/wdpa_url.R +++ b/R/wdpa_url.R @@ -60,8 +60,15 @@ wdpa_url <- function(x, wait = FALSE, page_wait = 2) { assertthat::is.flag(wait), assertthat::is.count(page_wait), assertthat::noNA(page_wait), - is_online(), - has_phantomjs(silent = FALSE)) + is_online() + ) + assertthat::assert_that( + has_phantomjs(), + msg = paste0( + "cannot find PhantomJS; please install it using: ", + "webdriver::install_phantomjs()" + ) + ) # declare hidden function try_and_find_url <- function(x) { ## initialize web driver @@ -144,7 +151,7 @@ start_phantomjs <- function() { pjs <- webdriver::run_phantomjs() ) } else { - pjs <- webdriver::run_phantomjs() + pjs <- suppressMessages(webdriver::run_phantomjs()) } # return object pjs @@ -155,15 +162,8 @@ stop_phantomjs <- function(pjs) { try(pjs$process$kill(), silent = TRUE) } -has_phantomjs <- function(silent = TRUE) { - assertthat::assert_that( - assertthat::is.flag(silent), - assertthat::noNA(silent) - ) - pjs <- try(start_phantomjs, silent = TRUE) - on.exit(stop_phantomjs(pjs)) - if (inherits(pjs, "try-error") && !isTRUE(silent)) { - stop(pjs) - } +has_phantomjs <- function() { + pjs <- suppressMessages(try(start_phantomjs(), silent = TRUE)) + on.exit(suppressMessages(stop_phantomjs(pjs))) !inherits(pjs, "try-error") } diff --git a/README.md b/README.md index 675819b..c23d341 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ To cite the latest official version, please use: To cite the latest development version, please use: > Hanson JO (2022). wdpar: Interface to the World Database on Protected -> Areas. R package version 1.3.3.2. Available at +> Areas. R package version 1.3.3.3. Available at > . To cite the World Database on Protected Areas (WDPA), please use: diff --git a/docs/404.html b/docs/404.html index 801809a..9268df5 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 3556542..90d0a0e 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index e214b47..40ae19d 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/articles/index.html b/docs/articles/index.html index 564c5b4..cec9351 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/articles/wdpar.html b/docs/articles/wdpar.html index 206d11b..685dd4f 100644 --- a/docs/articles/wdpar.html +++ b/docs/articles/wdpar.html @@ -33,7 +33,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 @@ -72,7 +72,7 @@

wdpar: Interface to the World Database on Protected Areas

Jeffrey O. Hanson

-

2022-09-28

+

2022-10-16

Source: vignettes/wdpar.Rmd diff --git a/docs/authors.html b/docs/authors.html index fcbc726..c4d8e95 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 @@ -64,12 +64,12 @@

Citation

-

Hanson JO (2022) wdpar: Interface to the World Database on Protected Areas. R package version 1.3.3.2. https://github.com/prioritizr/wdpar

+

Hanson JO (2022) wdpar: Interface to the World Database on Protected Areas. R package version 1.3.3.3. https://github.com/prioritizr/wdpar

@Manual{,
   author = {Jeffrey O Hanson},
   title = {wdpar: Interface to the World Database on Protected Areas},
   year = {2022},
-  note = {R package version 1.3.3.2},
+  note = {R package version 1.3.3.3},
   url = {https://github.com/prioritizr/wdpar},
 }

UNEP-WCMC and IUCN (2022) Protected Planet: The World Database on Protected Areas (WDPA), [insert month/year of the version downloaded], Cambridge, UK: UNEP-WCMC and IUCN. Available at: www.protectedplanet.net.

diff --git a/docs/index.html b/docs/index.html index 78f8d97..a6ca6d0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -38,7 +38,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 @@ -206,7 +206,7 @@

CitationTo cite the latest official version, please use:

Hanson JO (2022). wdpar: Interface to the World Database on Protected Areas. R package version 1.3.3. Available at https://CRAN.R-project.org/package=wdpar.

To cite the latest development version, please use:

-

Hanson JO (2022). wdpar: Interface to the World Database on Protected Areas. R package version 1.3.3.2. Available at https://github.com/prioritizr/wdpar.

+

Hanson JO (2022). wdpar: Interface to the World Database on Protected Areas. R package version 1.3.3.3. Available at https://github.com/prioritizr/wdpar.

To cite the World Database on Protected Areas (WDPA), please use:

UNEP-WCMC and IUCN ([insert year of the version downloaded]) Protected Planet: The World Database on Protected Areas (WDPA), [insert month/year of the version downloaded], Cambridge, UK: UNEP-WCMC and IUCN. Available at: www.protectedplanet.net.

To cite the World Database on Other Effective Area-Based Conservation Measures (WDOECM), please use:

diff --git a/docs/news/index.html b/docs/news/index.html index 8251921..f47da76 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 @@ -50,6 +50,9 @@

Changelog

Source: NEWS.md +
+ +
diff --git a/docs/reference/st_erase_overlaps.html b/docs/reference/st_erase_overlaps.html index 8d2d6ca..b65ca92 100644 --- a/docs/reference/st_erase_overlaps.html +++ b/docs/reference/st_erase_overlaps.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/st_repair_geometry.html b/docs/reference/st_repair_geometry.html index 869a6b1..d9631b0 100644 --- a/docs/reference/st_repair_geometry.html +++ b/docs/reference/st_repair_geometry.html @@ -17,7 +17,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_clean.html b/docs/reference/wdpa_clean.html index 31888ab..43fb101 100644 --- a/docs/reference/wdpa_clean.html +++ b/docs/reference/wdpa_clean.html @@ -25,7 +25,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_dissolve.html b/docs/reference/wdpa_dissolve.html index 716d1f8..aef2a7c 100644 --- a/docs/reference/wdpa_dissolve.html +++ b/docs/reference/wdpa_dissolve.html @@ -18,7 +18,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_fetch.html b/docs/reference/wdpa_fetch.html index 3be17b3..7b2e602 100644 --- a/docs/reference/wdpa_fetch.html +++ b/docs/reference/wdpa_fetch.html @@ -22,7 +22,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_latest_version.html b/docs/reference/wdpa_latest_version.html index 079a98b..df49545 100644 --- a/docs/reference/wdpa_latest_version.html +++ b/docs/reference/wdpa_latest_version.html @@ -22,7 +22,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_read.html b/docs/reference/wdpa_read.html index 595a541..09c0205 100644 --- a/docs/reference/wdpa_read.html +++ b/docs/reference/wdpa_read.html @@ -22,7 +22,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/docs/reference/wdpa_url.html b/docs/reference/wdpa_url.html index f2b0420..08dcc97 100644 --- a/docs/reference/wdpa_url.html +++ b/docs/reference/wdpa_url.html @@ -23,7 +23,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 @@ -119,12 +119,12 @@

Examples

# obtain url for New Zealand data nzl_url <- wdpa_url("New Zealand", wait = TRUE) print(nzl_url) -#> [1] "https://d1gam3xoknrgr2.cloudfront.net/current/WDPA_WDOECM_Sep2022_Public_NZL_shp.zip" +#> [1] "https://d1gam3xoknrgr2.cloudfront.net/current/WDPA_WDOECM_Oct2022_Public_NZL_shp.zip" # obtain url for New Zealand data using its ISO3 code nzl_url <- wdpa_url("NZL", wait = TRUE) print(nzl_url) -#> [1] "https://d1gam3xoknrgr2.cloudfront.net/current/WDPA_WDOECM_Sep2022_Public_NZL_shp.zip" +#> [1] "https://d1gam3xoknrgr2.cloudfront.net/current/WDPA_WDOECM_Oct2022_Public_NZL_shp.zip" # obtain url for global data global_url <- wdpa_url("global") diff --git a/docs/reference/wdpar.html b/docs/reference/wdpar.html index d75b97b..d73ac74 100644 --- a/docs/reference/wdpar.html +++ b/docs/reference/wdpar.html @@ -28,7 +28,7 @@ wdpar - 1.3.3.2 + 1.3.3.3 diff --git a/inst/doc/wdpar.html b/inst/doc/wdpar.html index 5d8d63b..8676a39 100644 --- a/inst/doc/wdpar.html +++ b/inst/doc/wdpar.html @@ -12,7 +12,7 @@ - + wdpar: Interface to the World Database on Protected Areas @@ -149,7 +149,7 @@

wdpar: Interface to the World Database on Protected Areas

Jeffrey O. Hanson

-

2022-09-28

+

2022-10-16