diff --git a/.github/workflows/R-CMD-check-macos.yaml b/.github/workflows/R-CMD-check-macos.yaml index 506f2b83..55811c9f 100644 --- a/.github/workflows/R-CMD-check-macos.yaml +++ b/.github/workflows/R-CMD-check-macos.yaml @@ -71,7 +71,6 @@ jobs: install.packages("sf") install.packages("terra") install.packages("lwgeom") - install.packages("rgdal") remotes::install_github("dickoa/prepr") remotes::install_github("r-spatial/link2GI") shell: Rscript {0} @@ -83,6 +82,11 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} + - name: Set R environmental variables + run: | + echo GGMAP_STADIAMAPS_API_KEY="$GGMAP_KEY" >> ~/.Renviron + shell: bash + - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true diff --git a/.github/workflows/R-CMD-check-ubuntu.yaml b/.github/workflows/R-CMD-check-ubuntu.yaml index d7294cc8..527e9a38 100644 --- a/.github/workflows/R-CMD-check-ubuntu.yaml +++ b/.github/workflows/R-CMD-check-ubuntu.yaml @@ -34,6 +34,7 @@ jobs: _R_CHECK_TIMINGS_: 10 _R_CHECK_CRAN_INCOMING_REMOTE_: false GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + GGMAP_KEY: ${{ secrets.GGMAP_STADIAMAPS_API_KEY }} CI: true steps: @@ -76,7 +77,6 @@ jobs: - name: Install spatial R packages run: | options(repos = "https://cloud.r-project.org/") - install.packages("rgdal") install.packages("sf") install.packages("terra") install.packages("lwgeom") @@ -93,6 +93,11 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} + - name: Set R environmental variables + run: | + echo GGMAP_STADIAMAPS_API_KEY="$GGMAP_KEY" >> ~/.Renviron + shell: bash + - name: Environmental variables if: matrix.config.pkgs == 'depends only' run: | diff --git a/.github/workflows/R-CMD-check-windows.yaml b/.github/workflows/R-CMD-check-windows.yaml index 0859b4d4..73659ba4 100644 --- a/.github/workflows/R-CMD-check-windows.yaml +++ b/.github/workflows/R-CMD-check-windows.yaml @@ -69,7 +69,6 @@ jobs: install.packages("sf") install.packages("terra") install.packages("lwgeom") - install.packages("rgdal") remotes::install_github("dickoa/prepr") shell: Rscript {0} @@ -80,6 +79,11 @@ jobs: sessioninfo::session_info(pkgs, include_base = TRUE) shell: Rscript {0} + - name: Set R environmental variables + run: | + echo GGMAP_STADIAMAPS_API_KEY="$GGMAP_KEY" >> ~/.Renviron + shell: bash + - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index bb501492..47b0fcc9 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -73,7 +73,6 @@ jobs: - name: Install spatial R packages run: | options(repos = "https://cloud.r-project.org/") - install.packages("rgdal") install.packages("sf") install.packages("terra") install.packages("lwgeom") diff --git a/DESCRIPTION b/DESCRIPTION index b212926e..696a57a0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: aoh Type: Package -Version: 0.0.2.8 +Version: 0.0.2.9 Title: Create Area of Habitat Data Description: Create Area of Habitat data to characterize species distributions. Data are produced following procedures outlined by Brooks et al. (2019) @@ -42,7 +42,8 @@ Imports: ggplot2 (>= 3.1.0), fasterize (>= 1.0.3), raster (>= 3.5-15), - rvest (>= 1.0.3) + rvest (>= 1.0.3), + jsonlite (>= 1.8.7) Suggests: sp (>= 2.0.0), testthat (>= 2.0.1), @@ -50,11 +51,10 @@ Suggests: roxygen2 (>= 6.1.1), rmarkdown (>= 1.10), pingr (>= 1.1.2), - ggmap (>= 2.6.1), + ggmap (>= 3.0.2.9002), fields (>= 14.0), smoothr (>= 0.2.2), rnaturalearth (>= 0.3.3), - rgdal (>= 1.5.27), gdalUtilities (>= 1.2.1), archive (>= 1.1.2), link2GI (>= 0.5-0), @@ -132,4 +132,5 @@ Collate: Roxygen: list(markdown = TRUE) Remotes: dickoa/prepr, - r-spatial/link2GI + r-spatial/link2GI, + dkahle/ggmap diff --git a/NEWS.md b/NEWS.md index d740c762..b401753d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# aoh 0.0.2.9 + +- Remove _rgdal_ package dependency. +- Updates URLs. +- Update functions for downloading preprocessed data from Zenodo. +- Update `plot_spp_aoh_data()` and `plot_spp_frc_data()` to be compatible + with changes to the _ggmap_ package for creating maps with a basemap. + # aoh 0.0.2.8 - Fix failing tests on continuous integration services (due to issues unzipping diff --git a/R/misc_zenodo.R b/R/misc_zenodo.R index 0c9a3046..e5839317 100644 --- a/R/misc_zenodo.R +++ b/R/misc_zenodo.R @@ -34,19 +34,14 @@ get_doi_files <- function(x) { # scrape html file d <- rvest::read_html(x) - # find file container - file_div <- rvest::html_elements(d, css = ".files-box") - - # find table in file container - file_table <- rvest::html_element(file_div, "table") - file_rows <- rvest::html_children(rvest::html_element(file_table, "tbody")) - file_info <- rvest::html_element(file_rows, "a") + # extract metedata + md <- rvest::html_elements(d, css = "#recordVersions") + md <- jsonlite::fromJSON(rvest::html_attr(md, "data-record")) # extract file details - file_names <- rvest::html_text(file_info) - file_urls <- paste0( - "https://zenodo.org", rvest::html_attr(file_info, "href") - ) + file_names <- names(md$files$entries) + file_urls <- paste0(md$links$files, "/", file_names, "?download=1") + file_urls <- gsub("/api/", "/", file_urls, fixed = TRUE) # return result tibble::tibble(filename = file_names, download = file_urls) @@ -83,53 +78,35 @@ get_doi_versions <- function(x) { d <- rvest::read_html(x) # find metadata containers - metadata_divs <- rvest::html_elements(d, css = ".metadata") - - # extract div containing version numbers - is_version_div <- vapply(metadata_divs, FUN.VALUE = logical(1), function(x) { - h <- rvest::html_elements(x, css = "h4") - if (length(h) == 0) return(FALSE) - h <- h[[1]] - identical(rvest::html_text(h), "Versions") + md <- rvest::html_elements(d, css = "#recordVersions") + md <- jsonlite::fromJSON(rvest::html_attr(md, "data-record")) + md <- rvest::read_html(md$links$versions) + md <- jsonlite::fromJSON(rvest::html_text(md), "p")$hits[[1]] + + # extract metadata + version <- vapply(md, FUN.VALUE = character(1), function(x) { + if (is.null(x$metadata)) return(NA_character_) + if (is.null(x$metadata$version)) return(NA_character_) + trimws(x$metadata$version) }) - - # return input doi if it's not associated with any versions - if (!any(is_version_div)) { - d <- tibble::tibble( - version = NA_character_, - created = as.POSIXct(NA_real_), - doi = gsub("https://doi.org/", "", x, fixed = TRUE) - ) - return(d) - } - - # extract div containing version numbers - version_div <- metadata_divs[[which(is_version_div)[[1]]]] - - # extract version table - version_table <- rvest::html_element(version_div, "table") - version_rows <- rvest::html_children(version_table) - - # parse information for each version - info <- lapply(version_rows, function(x) { - tibble::tibble( - version = trimws(gsub( - "Version ", "", fixed = TRUE, - rvest::html_text(rvest::html_element(x, "a")) - )), - created = as.POSIXct( - trimws(rvest::html_text( - rvest::html_element(rvest::html_children(x)[[2]], "small") - )), - format = "%b %e, %Y" - ), - doi = trimws(rvest::html_text(rvest::html_element(x, "small"))), - ) + created <- vapply(md, FUN.VALUE = character(1), function(x) { + if (is.null(x$metadata)) return(NA_character_) + if (is.null(x$metadata$publication_date)) return(NA_character_) + trimws(x$metadata$publication_date) + }) + doi <- vapply(md, FUN.VALUE = character(1), function(x) { + if (is.null(x$metadata)) return(NA_character_) + if (is.null(x$metadata$doi)) return(NA_character_) + trimws(x$metadata$doi) }) - # compile table - info <- dplyr::bind_rows(info) + # create table with metadata + info <- tibble::tibble( + version = version, + created = as.POSIXct(created, format = "%Y-%m-%d"), + doi = doi + ) - ## return result (reverse row ordering for compatibility with zen4R + # return result (reverse row ordering for compatibility with zen4R info[rev(seq_len(nrow(info))), , drop = FALSE] } diff --git a/R/plot_spp_aoh_data.R b/R/plot_spp_aoh_data.R index 3ff1245e..a2871a6f 100644 --- a/R/plot_spp_aoh_data.R +++ b/R/plot_spp_aoh_data.R @@ -18,14 +18,14 @@ NULL #' spatial extent of the data. #' #' @param zoom `numeric` Value indicating the zoom level for the basemap. -#' See documentation for the `zoom` parameter in the [ggmap::get_stamenmap()] +#' See documentation for the `zoom` parameter in the [ggmap::get_stadiamap()] #' function for details. #' Defaults to `NULL` such that no basemap is shown. #' #' @param maptype `character` Value indicating the name of the #' the basemap to use for the plot. #' See documentation for the `maptype` parameter in the -#' [ggmap::get_stamenmap()] +#' [ggmap::get_stadiamap()] #' function for details. #' Defaults to `NULL` such that no basemap is shown. #' Note that the \pkg{ggmap} package must be installed to show a basemap. @@ -33,7 +33,7 @@ NULL #' @param maxcell `integer` Maximum number of grid cells for mapping. #' Defaults to 50000. #' -#' @param ... Additional arguments passed to [ggmap::get_stamenmap()]. +#' @param ... Additional arguments passed to [ggmap::get_stadiamap()]. #' #' @details #' Note that data are automatically projected to a @@ -110,7 +110,7 @@ NULL #' if (require(ggmap)) { #' ## create customized map with basemap #' p3 <- -#' plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "toner") + +#' plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "stamen_toner") + #' scale_fill_manual( #' values = c("suitable" = "blue", "not suitable" = "transparent") #' ) + @@ -310,11 +310,18 @@ plot_spp_data <- function(x, max_plot = 9, expand = 0.05, #' #' @param x [sf::st_sf()] object. #' -#' @return A [ggmap::get_stamenmap()] object. +#' @return A [ggmap::get_stadiamap()] object. #' #' @noRd get_ggmap_basemap <- function(x, expand = 0.05, ...) { assertthat::assert_that(sf::st_crs(x) == sf::st_crs(4326)) + assertthat::assert_that( + nzchar(Sys.getenv("GGMAP_STADIAMAPS_API_KEY")), + msg = paste( + "StadiaMaps API key must be registered to plot a basemap,", + "see `?ggmap::register_stadiamaps` for details." + ) + ) bb <- as.list(sf::st_bbox(x)) bb2 <- bb if (expand > 0) { @@ -325,5 +332,5 @@ get_ggmap_basemap <- function(x, expand = 0.05, ...) { bb2[["ymin"]] <- bb[["ymin"]] - yf bb2[["ymax"]] <- bb[["ymax"]] + yf } - ggmap::get_stamenmap(unname(unlist(bb2)), ...) + ggmap::get_stadiamap(unname(unlist(bb2)), ...) } diff --git a/R/plot_spp_frc_data.R b/R/plot_spp_frc_data.R index 1f808301..bfb381be 100644 --- a/R/plot_spp_frc_data.R +++ b/R/plot_spp_frc_data.R @@ -88,7 +88,7 @@ NULL #' if (require(ggmap)) { #' ## create customized map with basemap #' p3 <- -#' plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "toner") + +#' plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "stamen_toner") + #' scale_fill_viridis_c() + #' scale_color_manual(values = c("range" = "red")) + #' scale_size_manual(values = c("range" = 1.5)) + diff --git a/README.Rmd b/README.Rmd index 8c278716..4b6deec4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -184,7 +184,11 @@ Finally, let's create some maps to compare the range data with the Area of habit # create maps ## N.B. you might need to install the ggmap package map <- - plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") + + plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + scale_fill_viridis_d() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 0.5)) + diff --git a/README.md b/README.md index 31a4765f..a83ec2de 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,11 @@ of habitat data. # create maps ## N.B. you might need to install the ggmap package map <- - plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") + + plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + scale_fill_viridis_d() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 0.5)) + @@ -345,7 +349,11 @@ map <- strip.text = element_text(color = "white"), strip.background = element_rect(fill = "black", color = "black") ) +``` + + ## |---------|---------|---------|---------|========================================= |---------|---------|---------|---------|========================================= +``` r # display maps print(map) ``` @@ -362,7 +370,7 @@ produce Area of Habitat data. relevant data using: Hanson JO (2023) aoh: Create Area of Habitat Data. R package version - 0.0.2.8. Available at https://github.com/prioritizr/aoh. + 0.0.2.9. Available at https://github.com/prioritizr/aoh. IUCN [insert year] IUCN Red List of Threatened Species. Version [insert version]. Available at www.iucnredlist.org. diff --git a/docs/404.html b/docs/404.html index 0adc7295..60016eb7 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/articles/aoh.html b/docs/articles/aoh.html index 8f19823a..3bc84937 100644 --- a/docs/articles/aoh.html +++ b/docs/articles/aoh.html @@ -33,7 +33,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -83,7 +83,7 @@ -

Hanson JO (2023) aoh: Create Area of Habitat Data. R package version 0.0.2.8. Available at https://github.com/prioritizr/aoh.

+

Hanson JO (2023) aoh: Create Area of Habitat Data. R package version 0.0.2.9. Available at https://github.com/prioritizr/aoh.

@Manual{,
   author = {Jeffrey O Hanson},
   title = {aoh: Create Area of Habitat Data},
   year = {2023},
-  note = {R package version 0.0.2.8},
+  note = {R package version 0.0.2.9},
   url = {https://github.com/prioritizr/aoh},
 }

IUCN [insert year] IUCN Red List of Threatened Species. Version [insert version]. Available at www.iucnredlist.org.

diff --git a/docs/index.html b/docs/index.html index 0b841587..4745d6cf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -46,7 +46,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -293,7 +293,11 @@

Usage # create maps ## N.B. you might need to install the ggmap package map <- - plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") + + plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + scale_fill_viridis_d() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 0.5)) + @@ -302,9 +306,10 @@

Usage axis.text = element_text(size = 6), strip.text = element_text(color = "white"), strip.background = element_rect(fill = "black", color = "black") - ) - -# display maps + ) +
## |---------|---------|---------|---------|=========================================                                          |---------|---------|---------|---------|=========================================                                          
+
+# display maps
 print(map)

@@ -312,48 +317,48 @@

Usage

Citation

Please cite the aoh R package and the underlying datasets used to produce Area of Habitat data.

-
Area of Habitat data are created using a range of different datasets.
-Depending on which datasets are used, please cite the aoh package and
-relevant data using:
-
-  Hanson JO (2023) aoh: Create Area of Habitat Data. R package version
-  0.0.2.8. Available at https://github.com/prioritizr/aoh.
-
-  IUCN [insert year] IUCN Red List of Threatened Species. Version
-  [insert version]. Available at www.iucnredlist.org.
-
-  BirdLife International and Handbook of the Birds of the World
-  ([insert year]) Bird species distribution maps of the world. Version
-  [insert version]. Available at
-  http://datazone.birdlife.org/species/requestdis.
-
-  Jung M, Dahal PR, Butchart SHM, Donald PF, De Lamo X, Lesiv M, Kapos
-  V, Rondinini C, Visconti P (2020). "A global map of terrestrial
-  habitat types." _Scientific Data_, *7*(1), 256.
-  doi:10.1038/s41597-020-00599-8
-  <https://doi.org/10.1038/s41597-020-00599-8>.
-
-  Jung M, Dahal PR, Butchart SHM, Donald PF, De Lamo X, Lesiv M, Kapos
-  V, Rondinini C, and Visconti P (2020b) A global map of terrestrial
-  habitat types (insert version) [Data set]. Zenodo. Available at
-  https://doi.org/10.5281/zenodo.4058819.
-
-  Lumbierres M, Dahal PR, Di Marco M, Butchart SHM, Donald PF,
-  Rondinini C (2021). "Translating habitat class to land cover to map
-  area of habitat of terrestrial vertebrates." _Conservation Biology_,
-  *36*(3), e13851. doi:10.1111/cobi.13851
-  <https://doi.org/10.1111/cobi.13851>.
-
-  Robinson N, Regetz J, Guralnick RP (2014). "EarthEnv-DEM90: A
-  nearly-global, void-free, multi-scale smoothed 90m digital elevation
-  model from fused ASTER and SRTM data." _ISPRS Journal of
-  Photogrammetry and Remote Sensing_, *87*(1), 57-67.
-  doi:10.1016/j.isprsjprs.2013.11.002
-  <https://doi.org/10.1016/j.isprsjprs.2013.11.002>.
-
-To see these entries in BibTeX format, use 'print(<citation>,
-bibtex=TRUE)', 'toBibtex(.)', or set
-'options(citation.bibtex.max=999)'.
+
Area of Habitat data are created using a range of different datasets.
+Depending on which datasets are used, please cite the aoh package and
+relevant data using:
+
+  Hanson JO (2023) aoh: Create Area of Habitat Data. R package version
+  0.0.2.9. Available at https://github.com/prioritizr/aoh.
+
+  IUCN [insert year] IUCN Red List of Threatened Species. Version
+  [insert version]. Available at www.iucnredlist.org.
+
+  BirdLife International and Handbook of the Birds of the World
+  ([insert year]) Bird species distribution maps of the world. Version
+  [insert version]. Available at
+  http://datazone.birdlife.org/species/requestdis.
+
+  Jung M, Dahal PR, Butchart SHM, Donald PF, De Lamo X, Lesiv M, Kapos
+  V, Rondinini C, Visconti P (2020). "A global map of terrestrial
+  habitat types." _Scientific Data_, *7*(1), 256.
+  doi:10.1038/s41597-020-00599-8
+  <https://doi.org/10.1038/s41597-020-00599-8>.
+
+  Jung M, Dahal PR, Butchart SHM, Donald PF, De Lamo X, Lesiv M, Kapos
+  V, Rondinini C, and Visconti P (2020b) A global map of terrestrial
+  habitat types (insert version) [Data set]. Zenodo. Available at
+  https://doi.org/10.5281/zenodo.4058819.
+
+  Lumbierres M, Dahal PR, Di Marco M, Butchart SHM, Donald PF,
+  Rondinini C (2021). "Translating habitat class to land cover to map
+  area of habitat of terrestrial vertebrates." _Conservation Biology_,
+  *36*(3), e13851. doi:10.1111/cobi.13851
+  <https://doi.org/10.1111/cobi.13851>.
+
+  Robinson N, Regetz J, Guralnick RP (2014). "EarthEnv-DEM90: A
+  nearly-global, void-free, multi-scale smoothed 90m digital elevation
+  model from fused ASTER and SRTM data." _ISPRS Journal of
+  Photogrammetry and Remote Sensing_, *87*(1), 57-67.
+  doi:10.1016/j.isprsjprs.2013.11.002
+  <https://doi.org/10.1016/j.isprsjprs.2013.11.002>.
+
+To see these entries in BibTeX format, use 'print(<citation>,
+bibtex=TRUE)', 'toBibtex(.)', or set
+'options(citation.bibtex.max=999)'.
diff --git a/docs/news/index.html b/docs/news/index.html index d3ed38ef..b961b0f7 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9
@@ -60,6 +60,13 @@

Changelog

Source: NEWS.md +
+ +
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index e46eece1..34653de9 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,5 +4,5 @@ pkgdown_sha: ~ articles: aoh: aoh.html customization: customization.html -last_built: 2023-09-20T00:22Z +last_built: 2023-11-01T22:52Z diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index c36c10e0..c24f2246 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ diff --git a/docs/reference/aoh.html b/docs/reference/aoh.html index 5d501f3b..339335ca 100644 --- a/docs/reference/aoh.html +++ b/docs/reference/aoh.html @@ -40,7 +40,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/calc_spp_frc_data.html b/docs/reference/calc_spp_frc_data.html index 19479d4c..b27b1682 100644 --- a/docs/reference/calc_spp_frc_data.html +++ b/docs/reference/calc_spp_frc_data.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -237,22 +237,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [1.5s] +#> initializing [1.7s] #> #> cleaning species range data -#> cleaning species range data [5.1s] +#> cleaning species range data [1.8s] #> #> importing species summary data -#> importing species summary data [676ms] +#> importing species summary data [443ms] #> #> importing species habitat data -#> importing species habitat data [343ms] +#> importing species habitat data [323ms] #> #> collating species data -#> collating species data [416ms] +#> collating species data [157ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [13ms] #> #> finished @@ -264,27 +264,27 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [13ms] +#> initializing [4ms] #> #> importing global elevation data -#> importing global elevation data [7.1s] +#> importing global elevation data [16.9s] #> #> importing global habitat data #> ! argument to "crosswalk_data" is missing the following 2 habitat classification codes: "7.1", "7.2" #> importing global habitat data -#> importing global habitat data [8.1s] +#> importing global habitat data [12.6s] #> #> generating Area of Habitat data -#> processing ■■■■■■■■■ [ 25% | ETA: 31s] -#> processing ■■■■■■■■■■■■■■■■ [ 50% | ETA: 21s] -#> processing ■■■■■■■■■■■■■■■■■■■■■■■ [ 75% | ETA: 13s] -#> processing [1m 2.8s] +#> processing ■■■■■■■■■ [ 25% | ETA: 11s] +#> processing ■■■■■■■■■■■■■■■■ [ 50% | ETA: 7s] +#> processing ■■■■■■■■■■■■■■■■■■■■■■■ [ 75% | ETA: 5s] +#> processing [20.7s] #> #> generating Area of Habitat data -#> generating Area of Habitat data [1m 2.9s] +#> generating Area of Habitat data [20.7s] #> #> post-processing results -#> post-processing results [42ms] +#> post-processing results [14ms] #> #> finished @@ -296,10 +296,7 @@

Examples

cache_dir = cache_dir ) #> importing global habitat data -#> importing global habitat data [5.1s] -#> -#> processing ■■■■■■■■■■■■■■■■ [ 50% | ETA: 1s] -#> processing [4.3s] +#> importing global habitat data [12.5s] #> # } diff --git a/docs/reference/create_spp_aoh_data.html b/docs/reference/create_spp_aoh_data.html index 1395d903..e9699169 100644 --- a/docs/reference/create_spp_aoh_data.html +++ b/docs/reference/create_spp_aoh_data.html @@ -22,7 +22,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -408,22 +408,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [1.3s] +#> initializing [1.6s] #> #> cleaning species range data -#> cleaning species range data [8.5s] +#> cleaning species range data [3.1s] #> #> importing species summary data -#> importing species summary data [383ms] +#> importing species summary data [330ms] #> #> importing species habitat data -#> importing species habitat data [344ms] +#> importing species habitat data [364ms] #> #> collating species data -#> collating species data [567ms] +#> collating species data [206ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [13ms] #> #> finished @@ -436,22 +436,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [12ms] +#> initializing [5ms] #> #> importing global elevation data -#> importing global elevation data [7s] +#> importing global elevation data [17.6s] #> #> importing global habitat data #> ! argument to "crosswalk_data" is missing the following 2 habitat classification codes: "7.1", "7.2" #> importing global habitat data -#> importing global habitat data [4.6s] +#> importing global habitat data [11.4s] #> #> generating Area of Habitat data #> skipping 4 species distributions already processed -#> generating Area of Habitat data [97ms] +#> generating Area of Habitat data [32ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [15ms] #> #> finished # } diff --git a/docs/reference/create_spp_frc_data.html b/docs/reference/create_spp_frc_data.html index d50bdd44..bc4e3a63 100644 --- a/docs/reference/create_spp_frc_data.html +++ b/docs/reference/create_spp_frc_data.html @@ -26,7 +26,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -445,22 +445,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [358ms] +#> initializing [341ms] #> #> cleaning species range data -#> cleaning species range data [8.4s] +#> cleaning species range data [3s] #> #> importing species summary data -#> importing species summary data [364ms] +#> importing species summary data [384ms] #> #> importing species habitat data -#> importing species habitat data [348ms] +#> importing species habitat data [326ms] #> #> collating species data -#> collating species data [579ms] +#> collating species data [214ms] #> #> post-processing results -#> post-processing results [46ms] +#> post-processing results [13ms] #> #> finished @@ -473,22 +473,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [13ms] +#> initializing [4ms] #> #> importing global elevation data -#> importing global elevation data [6.9s] +#> importing global elevation data [16.2s] #> #> importing global habitat data #> ! argument to "crosswalk_data" is missing the following 2 habitat classification codes: "7.1", "7.2" #> importing global habitat data -#> importing global habitat data [5.1s] +#> importing global habitat data [11.5s] #> #> generating Area of Habitat data #> skipping 4 species distributions already processed -#> generating Area of Habitat data [98ms] +#> generating Area of Habitat data [32ms] #> #> post-processing results -#> post-processing results [105ms] +#> post-processing results [34ms] #> #> finished # } diff --git a/docs/reference/create_spp_info_data.html b/docs/reference/create_spp_info_data.html index 61d1b1ae..76acff2b 100644 --- a/docs/reference/create_spp_info_data.html +++ b/docs/reference/create_spp_info_data.html @@ -22,7 +22,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -482,22 +482,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [352ms] +#> initializing [351ms] #> #> cleaning species range data -#> cleaning species range data [8.4s] +#> cleaning species range data [3.1s] #> #> importing species summary data -#> importing species summary data [364ms] +#> importing species summary data [328ms] #> #> importing species habitat data -#> importing species habitat data [347ms] +#> importing species habitat data [351ms] #> #> collating species data -#> collating species data [578ms] +#> collating species data [213ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [13ms] #> #> finished # } diff --git a/docs/reference/crosswalk_jung_lvl1_data.html b/docs/reference/crosswalk_jung_lvl1_data.html index 76b1ac96..29583a7c 100644 --- a/docs/reference/crosswalk_jung_lvl1_data.html +++ b/docs/reference/crosswalk_jung_lvl1_data.html @@ -28,7 +28,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/crosswalk_jung_lvl2_data.html b/docs/reference/crosswalk_jung_lvl2_data.html index 78999d42..ab926842 100644 --- a/docs/reference/crosswalk_jung_lvl2_data.html +++ b/docs/reference/crosswalk_jung_lvl2_data.html @@ -28,7 +28,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/crosswalk_jung_plvl1_data.html b/docs/reference/crosswalk_jung_plvl1_data.html index 64643079..81c0bcb9 100644 --- a/docs/reference/crosswalk_jung_plvl1_data.html +++ b/docs/reference/crosswalk_jung_plvl1_data.html @@ -24,7 +24,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/crosswalk_lumb_cgls_data.html b/docs/reference/crosswalk_lumb_cgls_data.html index 3cdc3fd8..5b9b01f3 100644 --- a/docs/reference/crosswalk_lumb_cgls_data.html +++ b/docs/reference/crosswalk_lumb_cgls_data.html @@ -26,7 +26,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/figures/README-map-1.png b/docs/reference/figures/README-map-1.png index e7b45fe3..f77649d7 100644 Binary files a/docs/reference/figures/README-map-1.png and b/docs/reference/figures/README-map-1.png differ diff --git a/docs/reference/get_global_elevation_data.html b/docs/reference/get_global_elevation_data.html index fcf87112..e524484b 100644 --- a/docs/reference/get_global_elevation_data.html +++ b/docs/reference/get_global_elevation_data.html @@ -20,7 +20,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_jung_lvl1_habitat_data.html b/docs/reference/get_jung_lvl1_habitat_data.html index 89424761..558ac0b7 100644 --- a/docs/reference/get_jung_lvl1_habitat_data.html +++ b/docs/reference/get_jung_lvl1_habitat_data.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_jung_lvl2_habitat_data.html b/docs/reference/get_jung_lvl2_habitat_data.html index 685eba4c..6ba796cd 100644 --- a/docs/reference/get_jung_lvl2_habitat_data.html +++ b/docs/reference/get_jung_lvl2_habitat_data.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_jung_plvl1_habitat_data.html b/docs/reference/get_jung_plvl1_habitat_data.html index fcd79ce6..50afa68c 100644 --- a/docs/reference/get_jung_plvl1_habitat_data.html +++ b/docs/reference/get_jung_plvl1_habitat_data.html @@ -20,7 +20,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_lumb_cgls_habitat_data.html b/docs/reference/get_lumb_cgls_habitat_data.html index 63a44e28..9ba8fd85 100644 --- a/docs/reference/get_lumb_cgls_habitat_data.html +++ b/docs/reference/get_lumb_cgls_habitat_data.html @@ -23,7 +23,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_spp_habitat_data.html b/docs/reference/get_spp_habitat_data.html index 4fa48eef..7e25cf00 100644 --- a/docs/reference/get_spp_habitat_data.html +++ b/docs/reference/get_spp_habitat_data.html @@ -20,7 +20,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_spp_summary_data.html b/docs/reference/get_spp_summary_data.html index 746f5b7b..d5d5a726 100644 --- a/docs/reference/get_spp_summary_data.html +++ b/docs/reference/get_spp_summary_data.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/get_spp_threat_data.html b/docs/reference/get_spp_threat_data.html index 724a4327..27368e55 100644 --- a/docs/reference/get_spp_threat_data.html +++ b/docs/reference/get_spp_threat_data.html @@ -20,7 +20,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/index.html b/docs/reference/index.html index ffb712ba..20142e45 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/is_gdal_calc_available.html b/docs/reference/is_gdal_calc_available.html index 681caac5..db786f8a 100644 --- a/docs/reference/is_gdal_calc_available.html +++ b/docs/reference/is_gdal_calc_available.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/is_grass_available.html b/docs/reference/is_grass_available.html index 9e45bc7c..c9916726 100644 --- a/docs/reference/is_grass_available.html +++ b/docs/reference/is_grass_available.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/is_iucn_rl_api_available.html b/docs/reference/is_iucn_rl_api_available.html index eafc250d..76d11868 100644 --- a/docs/reference/is_iucn_rl_api_available.html +++ b/docs/reference/is_iucn_rl_api_available.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/is_osgeo4w_available.html b/docs/reference/is_osgeo4w_available.html index 68e1047a..a5c93556 100644 --- a/docs/reference/is_osgeo4w_available.html +++ b/docs/reference/is_osgeo4w_available.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_codes_artificial.html b/docs/reference/iucn_habitat_codes_artificial.html index 0d9c95e6..ddda007a 100644 --- a/docs/reference/iucn_habitat_codes_artificial.html +++ b/docs/reference/iucn_habitat_codes_artificial.html @@ -22,7 +22,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_codes_introduced.html b/docs/reference/iucn_habitat_codes_introduced.html index d7189dc7..5c899cc6 100644 --- a/docs/reference/iucn_habitat_codes_introduced.html +++ b/docs/reference/iucn_habitat_codes_introduced.html @@ -22,7 +22,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_codes_marine.html b/docs/reference/iucn_habitat_codes_marine.html index a7167fd0..afefeb53 100644 --- a/docs/reference/iucn_habitat_codes_marine.html +++ b/docs/reference/iucn_habitat_codes_marine.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_codes_misc.html b/docs/reference/iucn_habitat_codes_misc.html index bfa01b30..b162ec1f 100644 --- a/docs/reference/iucn_habitat_codes_misc.html +++ b/docs/reference/iucn_habitat_codes_misc.html @@ -22,7 +22,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_codes_terrestrial.html b/docs/reference/iucn_habitat_codes_terrestrial.html index 9b31eb7a..35b2ecd0 100644 --- a/docs/reference/iucn_habitat_codes_terrestrial.html +++ b/docs/reference/iucn_habitat_codes_terrestrial.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_habitat_data.html b/docs/reference/iucn_habitat_data.html index 8a4ce047..afbd824f 100644 --- a/docs/reference/iucn_habitat_data.html +++ b/docs/reference/iucn_habitat_data.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/iucn_threat_data.html b/docs/reference/iucn_threat_data.html index de9140df..858860bb 100644 --- a/docs/reference/iucn_threat_data.html +++ b/docs/reference/iucn_threat_data.html @@ -21,7 +21,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/plot_spp_aoh_data-3.png b/docs/reference/plot_spp_aoh_data-3.png index efe18256..3091551f 100644 Binary files a/docs/reference/plot_spp_aoh_data-3.png and b/docs/reference/plot_spp_aoh_data-3.png differ diff --git a/docs/reference/plot_spp_aoh_data.html b/docs/reference/plot_spp_aoh_data.html index 4c7851e1..c28fd66f 100644 --- a/docs/reference/plot_spp_aoh_data.html +++ b/docs/reference/plot_spp_aoh_data.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -99,7 +99,7 @@

Arguments

zoom

numeric Value indicating the zoom level for the basemap. -See documentation for the zoom parameter in the ggmap::get_stamenmap() +See documentation for the zoom parameter in the ggmap::get_stadiamap() function for details. Defaults to NULL such that no basemap is shown.

@@ -108,7 +108,7 @@

Arguments

character Value indicating the name of the the basemap to use for the plot. See documentation for the maptype parameter in the -ggmap::get_stamenmap() +ggmap::get_stadiamap() function for details. Defaults to NULL such that no basemap is shown. Note that the ggmap package must be installed to show a basemap.

@@ -120,7 +120,7 @@

Arguments

...
-

Additional arguments passed to ggmap::get_stamenmap().

+

Additional arguments passed to ggmap::get_stadiamap().

@@ -165,22 +165,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [345ms] +#> initializing [334ms] #> #> cleaning species range data -#> cleaning species range data [9s] +#> cleaning species range data [3.4s] #> #> importing species summary data -#> importing species summary data [359ms] +#> importing species summary data [392ms] #> #> importing species habitat data -#> importing species habitat data [344ms] +#> importing species habitat data [324ms] #> #> collating species data -#> collating species data [625ms] +#> collating species data [236ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [13ms] #> #> finished @@ -192,22 +192,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [13ms] +#> initializing [4ms] #> #> importing global elevation data -#> importing global elevation data [7.1s] +#> importing global elevation data [17.8s] #> #> importing global habitat data #> ! argument to "crosswalk_data" is missing the following 2 habitat classification codes: "7.1", "7.2" #> importing global habitat data -#> importing global habitat data [6s] +#> importing global habitat data [11.8s] #> #> generating Area of Habitat data #> skipping 4 species distributions already processed -#> generating Area of Habitat data [100ms] +#> generating Area of Habitat data [33ms] #> #> post-processing results -#> post-processing results [44ms] +#> post-processing results [18ms] #> #> finished @@ -245,7 +245,7 @@

Examples

if (require(ggmap)) { ## create customized map with basemap p3 <- - plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "toner") + + plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "stamen_toner") + scale_fill_manual( values = c("suitable" = "blue", "not suitable" = "transparent") ) + @@ -263,6 +263,8 @@

Examples

} #> Loading required package: ggmap #> Google's Terms of Service: <https://mapsplatform.google.com> +#> Stadia Maps' Terms of Service: <https://stadiamaps.com/terms-of-service/> +#> OpenStreetMap's Tile Usage Policy: <https://operations.osmfoundation.org/policies/tiles/> #> Please cite ggmap if you use it! Use `citation("ggmap")` for details. #> #> Attaching package: ‘ggmap’ @@ -270,7 +272,7 @@

Examples

#> #> inset #> |---------|---------|---------|---------| ========================================= |---------|---------|---------|---------| ========================================= -#> Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL. +#> © Stadia Maps © Stamen Design © OpenMapTiles © OpenStreetMap contributors. #> Coordinate system already present. Adding new coordinate system, which will #> replace the existing one. diff --git a/docs/reference/plot_spp_frc_data-3.png b/docs/reference/plot_spp_frc_data-3.png index 1e10d3ae..0c056782 100644 Binary files a/docs/reference/plot_spp_frc_data-3.png and b/docs/reference/plot_spp_frc_data-3.png differ diff --git a/docs/reference/plot_spp_frc_data.html b/docs/reference/plot_spp_frc_data.html index 05339f6b..10f14729 100644 --- a/docs/reference/plot_spp_frc_data.html +++ b/docs/reference/plot_spp_frc_data.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9
@@ -101,7 +101,7 @@

Arguments

zoom

numeric Value indicating the zoom level for the basemap. -See documentation for the zoom parameter in the ggmap::get_stamenmap() +See documentation for the zoom parameter in the ggmap::get_stadiamap() function for details. Defaults to NULL such that no basemap is shown.

@@ -110,7 +110,7 @@

Arguments

character Value indicating the name of the the basemap to use for the plot. See documentation for the maptype parameter in the -ggmap::get_stamenmap() +ggmap::get_stadiamap() function for details. Defaults to NULL such that no basemap is shown. Note that the ggmap package must be installed to show a basemap.

@@ -122,7 +122,7 @@

Arguments

...
-

Additional arguments passed to ggmap::get_stamenmap().

+

Additional arguments passed to ggmap::get_stadiamap().

@@ -167,22 +167,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [1.3s] +#> initializing [333ms] #> #> cleaning species range data -#> cleaning species range data [9.5s] +#> cleaning species range data [3.5s] #> #> importing species summary data -#> importing species summary data [366ms] +#> importing species summary data [354ms] #> #> importing species habitat data -#> importing species habitat data [351ms] +#> importing species habitat data [330ms] #> #> collating species data -#> collating species data [644ms] +#> collating species data [237ms] #> #> post-processing results -#> post-processing results [43ms] +#> post-processing results [12ms] #> #> finished @@ -195,22 +195,22 @@

Examples

cache_dir = cache_dir ) #> initializing -#> initializing [13ms] +#> initializing [4ms] #> #> importing global elevation data -#> importing global elevation data [6.7s] +#> importing global elevation data [16.4s] #> #> importing global habitat data #> ! argument to "crosswalk_data" is missing the following 2 habitat classification codes: "7.1", "7.2" #> importing global habitat data -#> importing global habitat data [4.7s] +#> importing global habitat data [12.1s] #> #> generating Area of Habitat data #> skipping 4 species distributions already processed -#> generating Area of Habitat data [100ms] +#> generating Area of Habitat data [31ms] #> #> post-processing results -#> post-processing results [106ms] +#> post-processing results [34ms] #> #> finished @@ -223,7 +223,7 @@

Examples

) #> importing global habitat data #> skipping 4 species distributions already processed -#> importing global habitat data [5.1s] +#> importing global habitat data [11.6s] #> # plot the data to visualize the range maps and fractional coverage data p <- plot_spp_frc_data(spp_frc_data) @@ -259,7 +259,7 @@

Examples

if (require(ggmap)) { ## create customized map with basemap p3 <- - plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "toner") + + plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "stamen_toner") + scale_fill_viridis_c() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 1.5)) + @@ -273,7 +273,7 @@

Examples

## print customized plot print(p3) } -#> Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL. +#> © Stadia Maps © Stamen Design © OpenMapTiles © OpenStreetMap contributors. #> Coordinate system already present. Adding new coordinate system, which will #> replace the existing one. diff --git a/docs/reference/read_spp_range_data.html b/docs/reference/read_spp_range_data.html index 821d9b27..e88ecfcf 100644 --- a/docs/reference/read_spp_range_data.html +++ b/docs/reference/read_spp_range_data.html @@ -19,7 +19,7 @@ aoh - 0.0.2.8 + 0.0.2.9
diff --git a/docs/reference/simulate_spp_data.html b/docs/reference/simulate_spp_data.html index 9c371726..7235bdbe 100644 --- a/docs/reference/simulate_spp_data.html +++ b/docs/reference/simulate_spp_data.html @@ -19,7 +19,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -250,10 +250,10 @@

Examples

n = 5, boundary_data = boundary_data, cache_dir = download_dir ) #> importing global elevation data -#> importing global elevation data [6.8s] +#> importing global elevation data [17.6s] #> #> importing global habitat data -#> importing global habitat data [2m 2.2s] +#> importing global habitat data [51.9s] #> # preview species range data diff --git a/docs/reference/st_repair_geometry.html b/docs/reference/st_repair_geometry.html index 7ab23a81..787e6e5c 100644 --- a/docs/reference/st_repair_geometry.html +++ b/docs/reference/st_repair_geometry.html @@ -17,7 +17,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/system_gdal_version.html b/docs/reference/system_gdal_version.html index ad484152..0d6fa512 100644 --- a/docs/reference/system_gdal_version.html +++ b/docs/reference/system_gdal_version.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/terra_combine.html b/docs/reference/terra_combine.html index 03974fea..d01c39b2 100644 --- a/docs/reference/terra_combine.html +++ b/docs/reference/terra_combine.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/docs/reference/terra_gdal_calc.html b/docs/reference/terra_gdal_calc.html index 37a4917a..43f689db 100644 --- a/docs/reference/terra_gdal_calc.html +++ b/docs/reference/terra_gdal_calc.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -233,7 +233,7 @@

Examples

# run calculation y <- terra_gdal_calc(x, "(X < 20) * 1") -#> System command: gdal_calc.py -X "/tmp/Rtmp4sE146/filecfd072a49d4a.tif" --outfile="/tmp/Rtmp4sE146/filecfd07b285495.tif" --calc="(X < 20) * 1" --type="Float32" --co="NUM_THREADS=1" --co="COMPRESS=LZW" --co="PREDICTOR=1" +#> System command: gdal_calc.py -X "/tmp/RtmpMIzb2V/fileb71bf50a8b7fd.tif" --outfile="/tmp/RtmpMIzb2V/fileb71bf74285393.tif" --calc="(X < 20) * 1" --type="Float32" --co="NUM_THREADS=1" --co="COMPRESS=LZW" --co="PREDICTOR=1" # preview result print(y) @@ -242,7 +242,7 @@

Examples

#> resolution : 0.5, 0.5 (x, y) #> extent : -110, -90, 40, 60 (xmin, xmax, ymin, ymax) #> coord. ref. : lon/lat WGS 84 (EPSG:4326) -#> source : filecfd07b285495.tif +#> source : fileb71bf74285393.tif #> name : lyr.1 # } diff --git a/docs/reference/terra_gdal_crop.html b/docs/reference/terra_gdal_crop.html index c9213061..f84e14f1 100644 --- a/docs/reference/terra_gdal_crop.html +++ b/docs/reference/terra_gdal_crop.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -184,7 +184,7 @@

Examples

#> resolution : 0.5, 0.5 (x, y) #> extent : -105, -92.5, 41, 58.5 (xmin, xmax, ymin, ymax) #> coord. ref. : lon/lat WGS 84 (EPSG:4326) -#> source : filecfd0176c815f.tif +#> source : fileb71bf7e19c549.tif #> name : lyr.1 diff --git a/docs/reference/terra_gdal_project.html b/docs/reference/terra_gdal_project.html index 0d46a72b..f4299178 100644 --- a/docs/reference/terra_gdal_project.html +++ b/docs/reference/terra_gdal_project.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 @@ -194,7 +194,7 @@

Examples

#> resolution : 19999.99, 20000 (x, y) #> extent : -944881, 935118, 4664377, 7144377 (xmin, xmax, ymin, ymax) #> coord. ref. : +proj=lcc +lat_0=0 +lon_0=-100 +lat_1=48 +lat_2=33 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs -#> source : filecfd0524c01c8.tif +#> source : fileb71bf21cbbcb8.tif #> name : lyr.1 diff --git a/docs/reference/terra_gdal_rasterize.html b/docs/reference/terra_gdal_rasterize.html index 99722f21..50d42bfc 100644 --- a/docs/reference/terra_gdal_rasterize.html +++ b/docs/reference/terra_gdal_rasterize.html @@ -18,7 +18,7 @@ aoh - 0.0.2.8 + 0.0.2.9 diff --git a/inst/doc/aoh.Rmd b/inst/doc/aoh.Rmd index cf38a0cd..e1e5090d 100644 --- a/inst/doc/aoh.Rmd +++ b/inst/doc/aoh.Rmd @@ -161,7 +161,11 @@ Finally, let's create some maps to compare the range data with the Area of habit # create maps ## N.B. you might need to install the ggmap package to create the maps map <- - plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") + + plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + scale_fill_viridis_d() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 0.5)) + @@ -233,7 +237,7 @@ Here we provide answers to some of the frequently asked questions encountered wh * **Can I use habitat classification data from other data sources?** - Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/pan-european/corine-land-cover), and [MODIS Land Cover data (MCD12Q1)](https://lpdaac.usgs.gov/products/mcd12q1v006/)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the [IUCN Red List Habitat Classification Scheme](https://www.iucnredlist.org/resources/habitat-classification-scheme) [e.g., see @r2; @r9]. After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via `create_spp_aoh_data()`). For more information, see the [Customization vignette](customization.html). + Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/en/products/corine-land-cover), and [MODIS Land Cover data (MCD12Q1)](https://lpdaac.usgs.gov/products/mcd12q1v006/)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the [IUCN Red List Habitat Classification Scheme](https://www.iucnredlist.org/resources/habitat-classification-scheme) [e.g., see @r2; @r9]. After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via `create_spp_aoh_data()`). For more information, see the [Customization vignette](customization.html). * **The output Area of Habitat data have different spatial extents, how can I combine them together?** diff --git a/inst/doc/aoh.html b/inst/doc/aoh.html index d0e06707..64204c03 100644 --- a/inst/doc/aoh.html +++ b/inst/doc/aoh.html @@ -11,7 +11,7 @@ - + Getting started @@ -169,7 +169,7 @@

Getting started

-

2023-09-20

+

2023-11-02

@@ -282,10 +282,10 @@

Tutorial

## # A tibble: 4 × 5 ## id_no binomial seasonal path geometry ## <dbl> <chr> <int> <chr> <POLYGON [m]> -## 1 979 Alytes dickhilleni 1 /tmp/RtmppQMCt… ((-105506.8 4465112, -10… -## 2 59448 Calotriton asper 1 /tmp/RtmppQMCt… ((-238681 5029057, -2377… -## 3 4657 Chioglossa lusitanica 1 /tmp/RtmppQMCt… ((-859201.6 4559278, -85… -## 4 58622 Rana iberica 1 /tmp/RtmppQMCt… ((-849801.9 4614149, -84… +## 1 979 Alytes dickhilleni 1 /tmp/RtmpxdNih… ((-105506.8 4465112, -10… +## 2 59448 Calotriton asper 1 /tmp/RtmpxdNih… ((-238681 5029057, -2377… +## 3 4657 Chioglossa lusitanica 1 /tmp/RtmpxdNih… ((-859201.6 4559278, -85… +## 4 58622 Rana iberica 1 /tmp/RtmpxdNih… ((-849801.9 4614149, -84…

After generating the Area of Habitat data, we can import them.

# import the Area of Habitat data
 ## since the data for each species have a different spatial extent
@@ -342,19 +342,19 @@ 

Tutorial

spp_aoh_rasters <- terra_combine(spp_aoh_rasters)
## 
 |---------|---------|---------|---------|
-==========
+========
                                           
 
 |---------|---------|---------|---------|
-==========
+========
                                           
 
 |---------|---------|---------|---------|
-==========
+========
                                           
 
 |---------|---------|---------|---------|
-=====================
+=========================
                                           
# assign identifiers to layer names
 names(spp_aoh_rasters) <- paste0(
@@ -368,10 +368,14 @@ 

Tutorial

## resolution : 100, 100 (x, y) ## extent : -914731, 318669, 4364377, 5066777 (xmin, xmax, ymin, ymax) ## coord. ref. : World_Behrmann -## sources : spat_xr9LNoI3lw6sGAS_55478.tif -## spat_rl2INSwBzo3Bpiq_55478.tif -## spat_r513KMZWKhupFt8_55478.tif -## spat_29FAKr7VjmetEyo_55478.tif +## sources : spat_HPn6UMuggEKqVTn_752309.tif +## spat_AMY34IdEb9yBKOZ_752309.tif +## spat_raTJr8EPKYYg6V5_752309.tif +## spat_ITOzWXlpPYsO0Z1_752309.tif +## varnames : 979_1 +## 59448_1 +## 4657_1 +## ... ## names : AOH_979_1, AOH_59448_1, AOH_4657_1, AOH_58622_1 ## min values : 0, 0, 0, 0 ## max values : 1, 1, 1, 1
@@ -379,23 +383,24 @@

Tutorial

# create maps
 ## N.B. you might need to install the ggmap package to create the maps
 map <-
-  plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") +
-  scale_fill_viridis_d() +
-  scale_color_manual(values = c("range" = "red")) +
-  scale_size_manual(values = c("range" = 0.5)) +
-  theme(
-    axis.title = element_blank(),
-    axis.text = element_text(size = 6),
-    strip.text = element_text(color = "white"),
-    strip.background = element_rect(fill = "black", color = "black")
-  )
-
## 
-|---------|---------|---------|---------|
-=========================================
-                                          
-
# display maps
-print(map)
-

+ plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + + scale_fill_viridis_d() + + scale_color_manual(values = c("range" = "red")) + + scale_size_manual(values = c("range" = 0.5)) + + theme( + axis.title = element_blank(), + axis.text = element_text(size = 6), + strip.text = element_text(color = "white"), + strip.background = element_rect(fill = "black", color = "black") + ) + +# display maps +print(map)
+

Frequently asked questions

@@ -408,8 +413,8 @@

Frequently asked questions

Please open the .Renviron file on your computer (e.g., using usethis::edit_r_environ()). Next, please add the following text to the file (replacing the string with the token) and save the file:

IUCN_REDLIST_KEY="your_actual_token_not_this_string"

Please restart your R session. You should now be able to access the IUCN Red List API. To verify this, please try running the following R code and – assuming everything works correctly – you should see the current version of the IUCN Red List:

-
# verify access to IUCN Red List API
-rredlist::rl_version()
+
# verify access to IUCN Red List API
+rredlist::rl_version()

If these instructions did not work, please consult the documentation for the rredlist R package for further details.

  • Where can I find species range data for generating Area of Habitat data?

    Species range data can be obtained from the IUCN Red List (see Spatial Data Download resources). They can also be obtained from other data sources (see the question below for details).

  • @@ -426,7 +431,7 @@

    Frequently asked questions

  • Can I use elevation data from other data sources?

    Yes, you can use elevation data from a variety of sources. For example, elevation data could be derived from NASA’s Shuttle Radar Topography Mission (SRTM). After preparing the elevation data, they can be used to create Area of Habitat data (via create_spp_aoh_data()). For more information, see the Customization vignette.

  • Can I use habitat classification data from other data sources?

    -

    Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from Copernicus Corine Land Cover, and MODIS Land Cover data (MCD12Q1)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the IUCN Red List Habitat Classification Scheme (e.g., see Tracewski et al. 2016; Lumbierres et al. 2021). After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via create_spp_aoh_data()). For more information, see the Customization vignette.

  • +

    Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from Copernicus Corine Land Cover, and MODIS Land Cover data (MCD12Q1)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the IUCN Red List Habitat Classification Scheme (e.g., see Tracewski et al. 2016; Lumbierres et al. 2021). After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via create_spp_aoh_data()). For more information, see the Customization vignette.

  • The output Area of Habitat data have different spatial extents, how can I combine them together?

    The terra_combine() function can be used to align and combine a list of raster terra::rast() objects into a single object. Note that this procedure is only recommended when all species occur in the same geographic region. Please see the tutorial above for an example of using this function to combine Area of Habitat data for multiple species into a single object.

  • diff --git a/inst/doc/customization.Rmd b/inst/doc/customization.Rmd index 58415ae1..feeb1068 100644 --- a/inst/doc/customization.Rmd +++ b/inst/doc/customization.Rmd @@ -27,7 +27,7 @@ knitr::opts_chunk$set(fig.align = "center", eval = !is_check) ## Introduction -The _aoh R_ package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson _et al._ [-@r4] and habitat classification data derived from Lumbierres _et al._ [-@r9]. Its defaults also include using species' elevational limit and habitat preference data from the [International Union for Conservation of Nature (IUCN) Red List of Threatened Species](https://www.iucnredlist.org/). In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources [e.g., from @r5]. The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/pan-european/corine-land-cover) data or species' elevational limit data from the [BirdLife Data Zone](http://datazone.birdlife.org/home). +The _aoh R_ package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson _et al._ [-@r4] and habitat classification data derived from Lumbierres _et al._ [-@r9]. Its defaults also include using species' elevational limit and habitat preference data from the [International Union for Conservation of Nature (IUCN) Red List of Threatened Species](https://www.iucnredlist.org/). In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources [e.g., from @r5]. The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/en/products/corine-land-cover) data or species' elevational limit data from the [BirdLife Data Zone](http://datazone.birdlife.org/home). ## Tutorial @@ -247,7 +247,7 @@ map <- plot_spp_aoh_data( spp_aoh_data[1:4, ], zoom = 6, - maptype = "toner-background", + maptype = "stamen_toner_background", maxcell = Inf ) + scale_fill_viridis_d() + diff --git a/inst/doc/customization.html b/inst/doc/customization.html index 9aa6a334..e3bb9f53 100644 --- a/inst/doc/customization.html +++ b/inst/doc/customization.html @@ -11,7 +11,7 @@ - + Customization @@ -169,7 +169,7 @@

    Customization

    -

    2023-09-20

    +

    2023-11-02

    @@ -183,7 +183,7 @@

    2023-09-20

    Introduction

    -

    The aoh R package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson et al. (2014) and habitat classification data derived from Lumbierres et al. (2021). Its defaults also include using species’ elevational limit and habitat preference data from the International Union for Conservation of Nature (IUCN) Red List of Threatened Species. In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources (e.g., from Jung et al. 2020). The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from Copernicus Corine Land Cover data or species’ elevational limit data from the BirdLife Data Zone.

    +

    The aoh R package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson et al. (2014) and habitat classification data derived from Lumbierres et al. (2021). Its defaults also include using species’ elevational limit and habitat preference data from the International Union for Conservation of Nature (IUCN) Red List of Threatened Species. In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources (e.g., from Jung et al. 2020). The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from Copernicus Corine Land Cover data or species’ elevational limit data from the BirdLife Data Zone.

    Tutorial

    @@ -675,21 +675,21 @@

    Tutorial

    ## 15 1.5|3.5|3.8|4.4|5.5|14.5 1.5|3.5|3.8|4.4|5.5|14.5 32 ## elevation_upper xmin xmax ymin ymax path ## * <dbl> <dbl> <dbl> <dbl> <dbl> <chr> -## 1 830 -896631 -61631 4373077 5070077 /tmp/RtmppQMCtL/932_1.tif -## 2 999 -902631 -60631 4303077 5070077 /tmp/RtmppQMCtL/3032_1.tif -## 3 874 -707631 320369 4305077 5058077 /tmp/RtmppQMCtL/3046_1.tif -## 4 874 -734631 -504631 4658077 5011077 /tmp/RtmppQMCtL/3046_3.tif -## 5 874 -916631 -708631 4520077 5015077 /tmp/RtmppQMCtL/3046_4.tif -## 6 1050 -620631 320369 4304077 5058077 /tmp/RtmppQMCtL/3255_1.tif -## 7 933 -916631 116369 4304077 5044077 /tmp/RtmppQMCtL/4008_1.tif -## 8 942 -916631 266369 4303077 5070077 /tmp/RtmppQMCtL/4785_1.tif -## 9 1058 -910631 65369 4574077 5070077 /tmp/RtmppQMCtL/4973_1.tif -## 10 1018 -565631 -96631 4304077 4587077 /tmp/RtmppQMCtL/5854_1.tif -## 11 1052 -752631 -66631 4374077 5058077 /tmp/RtmppQMCtL/6068_1.tif -## 12 1017 -284631 239369 4373077 4967077 /tmp/RtmppQMCtL/6678_1.tif -## 13 1017 -794631 -396631 4901077 5070077 /tmp/RtmppQMCtL/6678_2.tif -## 14 1017 -617631 -393631 4304077 4447077 /tmp/RtmppQMCtL/6678_3.tif -## 15 1017 -868631 -654631 4404077 4576077 /tmp/RtmppQMCtL/6678_4.tif +## 1 830 -896631 -61631 4373077 5070077 /tmp/RtmpxdNihS/932_1.tif +## 2 999 -902631 -60631 4303077 5070077 /tmp/RtmpxdNihS/3032_1.tif +## 3 874 -707631 320369 4305077 5058077 /tmp/RtmpxdNihS/3046_1.tif +## 4 874 -734631 -504631 4658077 5011077 /tmp/RtmpxdNihS/3046_3.tif +## 5 874 -916631 -708631 4520077 5015077 /tmp/RtmpxdNihS/3046_4.tif +## 6 1050 -620631 320369 4304077 5058077 /tmp/RtmpxdNihS/3255_1.tif +## 7 933 -916631 116369 4304077 5044077 /tmp/RtmpxdNihS/4008_1.tif +## 8 942 -916631 266369 4303077 5070077 /tmp/RtmpxdNihS/4785_1.tif +## 9 1058 -910631 65369 4574077 5070077 /tmp/RtmpxdNihS/4973_1.tif +## 10 1018 -565631 -96631 4304077 4587077 /tmp/RtmpxdNihS/5854_1.tif +## 11 1052 -752631 -66631 4374077 5058077 /tmp/RtmpxdNihS/6068_1.tif +## 12 1017 -284631 239369 4373077 4967077 /tmp/RtmpxdNihS/6678_1.tif +## 13 1017 -794631 -396631 4901077 5070077 /tmp/RtmpxdNihS/6678_2.tif +## 14 1017 -617631 -393631 4304077 4447077 /tmp/RtmpxdNihS/6678_3.tif +## 15 1017 -868631 -654631 4404077 4576077 /tmp/RtmpxdNihS/6678_4.tif ## geometry ## * <MULTIPOLYGON [m]> ## 1 (((-258785.9 4373975, -259388.9 4373961, -259722.7 4374219, -259763.3 437477… @@ -714,7 +714,7 @@

    Tutorial

    plot_spp_aoh_data( spp_aoh_data[1:4, ], zoom = 6, - maptype = "toner-background", + maptype = "stamen_toner_background", maxcell = Inf ) + scale_fill_viridis_d() + @@ -729,7 +729,7 @@

    Tutorial

    # display maps print(map)
    -

    +

    Conclusion

    diff --git a/man/figures/README-map-1.png b/man/figures/README-map-1.png index e7b45fe3..f77649d7 100644 Binary files a/man/figures/README-map-1.png and b/man/figures/README-map-1.png differ diff --git a/man/plot_spp_aoh_data.Rd b/man/plot_spp_aoh_data.Rd index 86ede644..5941fa6a 100644 --- a/man/plot_spp_aoh_data.Rd +++ b/man/plot_spp_aoh_data.Rd @@ -28,14 +28,14 @@ Defaults to 0.05 such that plot limits are extended 5\% beyond the spatial extent of the data.} \item{zoom}{\code{numeric} Value indicating the zoom level for the basemap. -See documentation for the \code{zoom} parameter in the \code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}} +See documentation for the \code{zoom} parameter in the \code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}} function for details. Defaults to \code{NULL} such that no basemap is shown.} \item{maptype}{\code{character} Value indicating the name of the the basemap to use for the plot. See documentation for the \code{maptype} parameter in the -\code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}} +\code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}} function for details. Defaults to \code{NULL} such that no basemap is shown. Note that the \pkg{ggmap} package must be installed to show a basemap.} @@ -43,7 +43,7 @@ Note that the \pkg{ggmap} package must be installed to show a basemap.} \item{maxcell}{\code{integer} Maximum number of grid cells for mapping. Defaults to 50000.} -\item{...}{Additional arguments passed to \code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}}.} +\item{...}{Additional arguments passed to \code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}}.} } \value{ A \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} object. @@ -124,7 +124,7 @@ print(p2) if (require(ggmap)) { ## create customized map with basemap p3 <- - plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "toner") + + plot_spp_aoh_data(spp_aoh_data, zoom = 7, maptype = "stamen_toner") + scale_fill_manual( values = c("suitable" = "blue", "not suitable" = "transparent") ) + diff --git a/man/plot_spp_frc_data.Rd b/man/plot_spp_frc_data.Rd index fbcf984b..f79ba9d7 100644 --- a/man/plot_spp_frc_data.Rd +++ b/man/plot_spp_frc_data.Rd @@ -28,14 +28,14 @@ Defaults to 0.05 such that plot limits are extended 5\% beyond the spatial extent of the data.} \item{zoom}{\code{numeric} Value indicating the zoom level for the basemap. -See documentation for the \code{zoom} parameter in the \code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}} +See documentation for the \code{zoom} parameter in the \code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}} function for details. Defaults to \code{NULL} such that no basemap is shown.} \item{maptype}{\code{character} Value indicating the name of the the basemap to use for the plot. See documentation for the \code{maptype} parameter in the -\code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}} +\code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}} function for details. Defaults to \code{NULL} such that no basemap is shown. Note that the \pkg{ggmap} package must be installed to show a basemap.} @@ -43,7 +43,7 @@ Note that the \pkg{ggmap} package must be installed to show a basemap.} \item{maxcell}{\code{integer} Maximum number of grid cells for mapping. Defaults to 50000.} -\item{...}{Additional arguments passed to \code{\link[ggmap:get_stamenmap]{ggmap::get_stamenmap()}}.} +\item{...}{Additional arguments passed to \code{\link[ggmap:get_stadiamap]{ggmap::get_stadiamap()}}.} } \value{ A \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} object. @@ -133,7 +133,7 @@ print(p2) if (require(ggmap)) { ## create customized map with basemap p3 <- - plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "toner") + + plot_spp_frc_data(spp_frc_data, zoom = 7, maptype = "stamen_toner") + scale_fill_viridis_c() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 1.5)) + diff --git a/tests/testthat/test_create_spp_aoh_data.R b/tests/testthat/test_create_spp_aoh_data.R index ae6447d5..6e4dcb88 100644 --- a/tests/testthat/test_create_spp_aoh_data.R +++ b/tests/testthat/test_create_spp_aoh_data.R @@ -3,7 +3,6 @@ context("create_spp_aoh_data()") test_that("simulated data (terra engine)", { # skip if needed skip_on_cran() - skip_if_not_installed("rgdal") # specify file path f <- system.file("testdata", "SIMULATED_SPECIES.zip", package = "aoh") elevation_data <- terra::rast( @@ -86,7 +85,6 @@ test_that("simulated data (terra engine)", { test_that("simulated data (GDAL engine)", { # skip if needed skip_on_cran() - skip_if_not_installed("rgdal") skip_if_not_installed("gdalUtilities") skip_if_gdal_calc_not_available() # specify file path @@ -175,7 +173,6 @@ test_that("simulated data (GRASS engine)", { # skip if needed skip_on_cran() skip_on_os("windows") - skip_if_not_installed("rgdal") skip_if_not_installed("sp") skip_if_not_installed("gdalUtilities") skip_if_not_installed("rgrass") @@ -266,7 +263,6 @@ test_that("example data", { # skip if needed skip_on_cran() skip_on_ci() - skip_if_not_installed("rgdal") skip_if_not_installed("vcr") skip_if_cached_data_not_available() skip_if_zenodo_data_not_available(latest_lumb_cgls_version) @@ -347,7 +343,6 @@ test_that("example data", { test_that("some species missing habitat data", { # skip if needed skip_on_cran() - skip_if_not_installed("rgdal") # specify file path f <- system.file("testdata", "SIMULATED_SPECIES.zip", package = "aoh") elevation_data <- terra::rast( @@ -450,7 +445,6 @@ test_that("some species missing habitat data", { test_that("small range data (rasterize_touches, engine = terra)", { # skip if needed skip_on_cran() - skip_if_not_installed("rgdal") # specify file path f <- system.file("testdata", "SIMULATED_SPECIES.zip", package = "aoh") elevation_data <- terra::rast( @@ -553,7 +547,6 @@ test_that("small range data (rasterize_touches, engine = terra)", { test_that("small range data (rasterize_touches, engine = gdal)", { # skip if needed skip_on_cran() - skip_if_not_installed("rgdal") skip_if_not_installed("gdalUtilities") skip_if_gdal_calc_not_available() # specify file path diff --git a/tests/testthat/test_misc_terra.R b/tests/testthat/test_misc_terra.R index 29d540a3..ace78af2 100644 --- a/tests/testthat/test_misc_terra.R +++ b/tests/testthat/test_misc_terra.R @@ -47,7 +47,6 @@ test_that("terra_st_bbox()", { test_that("terra_fasterize() (small dataset)", { skip_on_cran() - skip_if_not_installed("rgdal") # load data nc <- sf::read_sf(system.file("shape/nc.shp", package = "sf")) nc <- sf::st_transform(nc, sf::st_crs("ESRI:54017")) @@ -68,7 +67,6 @@ test_that("terra_fasterize() (small dataset)", { test_that("terra_fasterize() (large dataset)", { skip_on_cran() - skip_if_not_installed("rgdal") skip_if_not_installed("rnaturalearth") # load data d <- rnaturalearth::ne_countries(type = "countries", returnclass = "sf") diff --git a/tests/testthat/test_misc_zenodo.R b/tests/testthat/test_misc_zenodo.R index 956abbc0..bb70deb0 100644 --- a/tests/testthat/test_misc_zenodo.R +++ b/tests/testthat/test_misc_zenodo.R @@ -11,9 +11,9 @@ test_that("get_doi_files", { "prioritizr/jung-habitat-data-v1.0.0.zip" ), download = c( - "https://zenodo.org/record/6622038/files/jung-lvl1-10-5281_zenodo-4058819.tif?download=1", - "https://zenodo.org/record/6622038/files/jung-lvl2-10-5281_zenodo-4058819.tif?download=1", - "https://zenodo.org/record/6622038/files/prioritizr/jung-habitat-data-v1.0.0.zip?download=1" + "https://zenodo.org/records/6622038/files/jung-lvl1-10-5281_zenodo-4058819.tif?download=1", + "https://zenodo.org/records/6622038/files/jung-lvl2-10-5281_zenodo-4058819.tif?download=1", + "https://zenodo.org/records/6622038/files/prioritizr/jung-habitat-data-v1.0.0.zip?download=1" ) ) expect_equal(x, y,) @@ -50,7 +50,7 @@ test_that("get_doi_versions (single version)", { x <- get_doi_versions("https://doi.org/10.5281/zenodo.46757") y <- tibble::tibble( version = NA_character_, - created = as.POSIXct(NA_real_), + created = as.POSIXct("2016-03-01", format = "%Y-%m-%d"), doi = c("10.5281/zenodo.46757") ) expect_equal(x, y) diff --git a/tests/testthat/test_plot_spp_aoh_data.R b/tests/testthat/test_plot_spp_aoh_data.R index 7ed81c47..01e4d5d6 100644 --- a/tests/testthat/test_plot_spp_aoh_data.R +++ b/tests/testthat/test_plot_spp_aoh_data.R @@ -44,6 +44,7 @@ test_that("base map", { # skip if needed skip_on_cran() skip_if_not_installed("ggmap") + skip_if_not(nzchar(Sys.getenv("GGMAP_STADIAMAPS_API_KEY"))) # specify file path f <- system.file("testdata", "SIMULATED_SPECIES.zip", package = "aoh") elevation_data <- terra::rast( @@ -75,7 +76,7 @@ test_that("base map", { verbose = interactive() ) # create object - p <- plot_spp_aoh_data(x, zoom = 3, maptype = "toner") + p <- plot_spp_aoh_data(x, zoom = 3, maptype = "stamen_toner") # tests expect_is(p, "gg") expect_is(suppressWarnings(print(p)), "gg") diff --git a/tests/testthat/test_plot_spp_frc_data.R b/tests/testthat/test_plot_spp_frc_data.R index 5be91870..55ccdbb0 100644 --- a/tests/testthat/test_plot_spp_frc_data.R +++ b/tests/testthat/test_plot_spp_frc_data.R @@ -45,6 +45,7 @@ test_that("base map", { # skip if needed skip_on_cran() skip_if_not_installed("ggmap") + skip_if_not(nzchar(Sys.getenv("GGMAP_STADIAMAPS_API_KEY"))) # specify file path f <- system.file("testdata", "SIMULATED_SPECIES.zip", package = "aoh") elevation_data <- terra::rast( @@ -77,7 +78,7 @@ test_that("base map", { verbose = interactive() ) # create object - p <- plot_spp_frc_data(x, zoom = 3, maptype = "toner") + p <- plot_spp_frc_data(x, zoom = 3, maptype = "stamen_toner") # tests expect_is(p, "gg") expect_is(suppressWarnings(print(p)), "gg") diff --git a/vignettes/aoh.Rmd b/vignettes/aoh.Rmd index cf38a0cd..e1e5090d 100644 --- a/vignettes/aoh.Rmd +++ b/vignettes/aoh.Rmd @@ -161,7 +161,11 @@ Finally, let's create some maps to compare the range data with the Area of habit # create maps ## N.B. you might need to install the ggmap package to create the maps map <- - plot_spp_aoh_data(spp_aoh_data, zoom = 6, maptype = "toner-background") + + plot_spp_aoh_data( + spp_aoh_data, + zoom = 6, + maptype = "stamen_toner_background" + ) + scale_fill_viridis_d() + scale_color_manual(values = c("range" = "red")) + scale_size_manual(values = c("range" = 0.5)) + @@ -233,7 +237,7 @@ Here we provide answers to some of the frequently asked questions encountered wh * **Can I use habitat classification data from other data sources?** - Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/pan-european/corine-land-cover), and [MODIS Land Cover data (MCD12Q1)](https://lpdaac.usgs.gov/products/mcd12q1v006/)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the [IUCN Red List Habitat Classification Scheme](https://www.iucnredlist.org/resources/habitat-classification-scheme) [e.g., see @r2; @r9]. After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via `create_spp_aoh_data()`). For more information, see the [Customization vignette](customization.html). + Yes, you can use habitat classification data from a variety of sources. For example, the habitat classification data could be derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/en/products/corine-land-cover), and [MODIS Land Cover data (MCD12Q1)](https://lpdaac.usgs.gov/products/mcd12q1v006/)). To use such data, you will also need to develop a crosswalk table to specify which land cover (or habitat) classes correspond to which habitat classes as defined by the [IUCN Red List Habitat Classification Scheme](https://www.iucnredlist.org/resources/habitat-classification-scheme) [e.g., see @r2; @r9]. After preparing the habitat classification data and the crosswalk table, they can be used to create Area of Habitat data (via `create_spp_aoh_data()`). For more information, see the [Customization vignette](customization.html). * **The output Area of Habitat data have different spatial extents, how can I combine them together?** diff --git a/vignettes/customization.Rmd b/vignettes/customization.Rmd index 58415ae1..feeb1068 100644 --- a/vignettes/customization.Rmd +++ b/vignettes/customization.Rmd @@ -27,7 +27,7 @@ knitr::opts_chunk$set(fig.align = "center", eval = !is_check) ## Introduction -The _aoh R_ package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson _et al._ [-@r4] and habitat classification data derived from Lumbierres _et al._ [-@r9]. Its defaults also include using species' elevational limit and habitat preference data from the [International Union for Conservation of Nature (IUCN) Red List of Threatened Species](https://www.iucnredlist.org/). In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources [e.g., from @r5]. The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/pan-european/corine-land-cover) data or species' elevational limit data from the [BirdLife Data Zone](http://datazone.birdlife.org/home). +The _aoh R_ package provides a flexible framework for generating Area of Habitat data. By default, it will use elevation data derived from Robinson _et al._ [-@r4] and habitat classification data derived from Lumbierres _et al._ [-@r9]. Its defaults also include using species' elevational limit and habitat preference data from the [International Union for Conservation of Nature (IUCN) Red List of Threatened Species](https://www.iucnredlist.org/). In addition to these defaults, it provides built-in functions to use habitat classification derived from other data sources [e.g., from @r5]. The package can also be used to generate Area of Habitat data using other datasets that have been manually created by the user. For example, it could be used to produce Area of Habitat data using habitat classification data derived from [Copernicus Corine Land Cover](https://land.copernicus.eu/en/products/corine-land-cover) data or species' elevational limit data from the [BirdLife Data Zone](http://datazone.birdlife.org/home). ## Tutorial @@ -247,7 +247,7 @@ map <- plot_spp_aoh_data( spp_aoh_data[1:4, ], zoom = 6, - maptype = "toner-background", + maptype = "stamen_toner_background", maxcell = Inf ) + scale_fill_viridis_d() +