Title: | An Interface to the World Database on Protected Areas (WDPA) |
---|---|
Description: | This package is an interface to the World Database on Protected Areas <https://www.protectedplanet.net> and its API <https://api.protectedplanet.net>. User can download terrestrial and marine protected areas for the world countries (one country at the time). |
Authors: | Nicolas Casajus [aut, cre] , Kevin Cazelles [ctb, rev] |
Maintainer: | Nicolas Casajus <[email protected]> |
License: | GPL-3 + file LICENSE |
Version: | 2.1.0 |
Built: | 2024-10-30 05:01:21 UTC |
Source: | https://github.com/FRBCesab/worldpa |
This function gets the list of world countries listed by the UNEP-WCMC using the Protected Planet API https://api.protectedplanet.net/.
get_countries(sleep = 0, key = "WDPA_KEY")
get_countries(sleep = 0, key = "WDPA_KEY")
sleep |
a numeric specifying the time interval (in seconds) to suspend between each API request. |
key |
a character providing the WDPA token name stored in the
|
A data frame with the following information (columns) for each World countries (rows):
the name of the region
the ISO-2 code of the region
the name of the country
the ISO-3 code of the country
the number of protected areas per country
wdpa_countries
, get_wdpa
## Not run: ## List World Countries ---- countries <- worldpa::get_countries(sleep = 0.25) head(countries) ## region_name region_iso2 country_name country_iso3 pas_count ## 1 Africa AF Algeria DZA 78 ## 2 Africa AF Angola AGO 14 ## 3 Africa AF Benin BEN 64 ## 4 Africa AF Botswana BWA 22 ## 5 Africa AF Burkina Faso BFA 112 ## 6 Africa AF Burundi BDI 21 ## End(Not run)
## Not run: ## List World Countries ---- countries <- worldpa::get_countries(sleep = 0.25) head(countries) ## region_name region_iso2 country_name country_iso3 pas_count ## 1 Africa AF Algeria DZA 78 ## 2 Africa AF Angola AGO 14 ## 3 Africa AF Benin BEN 64 ## 4 Africa AF Botswana BWA 22 ## 5 Africa AF Burkina Faso BFA 112 ## 6 Africa AF Burundi BDI 21 ## End(Not run)
This function checks if the user has stored a valid Protected Planet API
token in the R environment file (.Renviron
).
get_token(key = "WDPA_KEY")
get_token(key = "WDPA_KEY")
key |
a character providing the WDPA token name stored in the
|
Before using this package for the first time, the user must follow these steps:
Fill in the form available at: https://api.protectedplanet.net/request to obtain a personal API token;
Store the token in the .Renviron
file under the key WDPA_KEY
.
User can use the function usethis::edit_r_environ
to open this
file;
Restart R.
A vector of length one with the value of the API token.
## Not run: ## Check if Protected Planet API token is stored ---- worldpa::get_token() ## End(Not run)
## Not run: ## Check if Protected Planet API token is stored ---- worldpa::get_token() ## End(Not run)
This function downloads protected areas for one country using the WDPA API.
get_wdpa(isocode, path = "wdpa", key = "WDPA_KEY")
get_wdpa(isocode, path = "wdpa", key = "WDPA_KEY")
isocode |
a character specifying the ISO-3 code of the country |
path |
the path (directory) to save spatial dataset ( |
key |
a character providing the WDPA token name stored in the
|
A sf
object (GEOMETRY) of protected areas defined in the
EPSG 4326 with the following 19 attributes:
the ID of the protected area on the WDPA database
the name of the protected area on the WDPA database
the original name of the protected area
the ISO-3 code of the country
the name of the country
the owner of the protected area
a boolean: TRUE
for marine and FALSE
for terrestrial
protected area
the designation of the protected area
the IUCN category
the no take status
the (reported) area of the protected area
the (reported) area of the marine part of the protected area
the (reported) area of the no take part of the protected area
the legal status of the protected area
the management authority
the type of gouvernance
the URL of the management plan
the URL of the protected area page on the Protected Planet website
the date of the last update of the legal status
Spatial data are also written on the hard drive in the folder path
as a
geopackage. Filename is structured as XXX_protectedareas.gpkg (where
XXX
is the ISO-3 code of the country). If the path
folder does not exist
it will created relatively to the current directory.
Note that some geometries are POINTS not (MULTIPOLYGONS).
wdpa_countries
, get_countries
## Not run: ## Get the ISO-3 code of Georgia ---- data("wdpa_countries", package = "worldpa") wdpa_countries[grep("Georgia", wdpa_countries$"country_name"), 3:4] ## country_name country_iso3 ## 133 Georgia GEO ## 235 South Georgia and the South Sandwich Islands SGS ## Download Protected Areas for Georgia ---- worldpa::get_wdpa(isocode = "GEO", path = file.path("data", "wdpa")) ## End(Not run)
## Not run: ## Get the ISO-3 code of Georgia ---- data("wdpa_countries", package = "worldpa") wdpa_countries[grep("Georgia", wdpa_countries$"country_name"), 3:4] ## country_name country_iso3 ## 133 Georgia GEO ## 235 South Georgia and the South Sandwich Islands SGS ## Download Protected Areas for Georgia ---- worldpa::get_wdpa(isocode = "GEO", path = file.path("data", "wdpa")) ## End(Not run)
This dataset contains information about countries listed in the Protected
Planet project (https://www.protectedplanet.net). This dataset has
been built using the Protected Planet API the 2021/02/12. For a more
up-to-date version, please use the function get_countries
.
wdpa_countries
wdpa_countries
A data frame with 248 rows (countries) and the following 5 columns:
the name of the region
the ISO-2 code of the region
the name of the country
the ISO-3 code of the country
the number of protected areas per country
https://www.protectedplanet.net/c/unep-regions