Package 'worldpa'

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

Help Index


Get World Countries Listed by the UNEP-WCMC

Description

This function gets the list of world countries listed by the UNEP-WCMC using the Protected Planet API https://api.protectedplanet.net/.

Usage

get_countries(sleep = 0, key = "WDPA_KEY")

Arguments

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 .Renviron file. Default is WDPA_KEY.

Value

A data frame with the following information (columns) for each World countries (rows):

region_name

the name of the region

region_iso2

the ISO-2 code of the region

country_name

the name of the country

country_iso3

the ISO-3 code of the country

pas_count

the number of protected areas per country

See Also

wdpa_countries, get_wdpa

Examples

## 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)

Check Protected Planet API Token

Description

This function checks if the user has stored a valid Protected Planet API token in the R environment file (.Renviron).

Usage

get_token(key = "WDPA_KEY")

Arguments

key

a character providing the WDPA token name stored in the .Renviron file. Default is WDPA_KEY.

Details

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.

Value

A vector of length one with the value of the API token.

Examples

## Not run: 
## Check if Protected Planet API token is stored ----
worldpa::get_token()

## End(Not run)

Download Protected Areas by Country

Description

This function downloads protected areas for one country using the WDPA API.

Usage

get_wdpa(isocode, path = "wdpa", key = "WDPA_KEY")

Arguments

isocode

a character specifying the ISO-3 code of the country

path

the path (directory) to save spatial dataset (.gpkg). Default is: ⁠wdpa/⁠.

key

a character providing the WDPA token name stored in the .Renviron file. Default is WDPA_KEY.

Value

A sf object (GEOMETRY) of protected areas defined in the EPSG 4326 with the following 19 attributes:

wdpa_id

the ID of the protected area on the WDPA database

pa_name

the name of the protected area on the WDPA database

original_name

the original name of the protected area

country_iso3

the ISO-3 code of the country

country

the name of the country

owner_type

the owner of the protected area

is_marine

a boolean: TRUE for marine and FALSE for terrestrial protected area

designation

the designation of the protected area

iucn_category

the IUCN category

no_take_status

the no take status

reported_area

the (reported) area of the protected area

reported_marine_area

the (reported) area of the marine part of the protected area

no_take_area

the (reported) area of the no take part of the protected area

legal_status

the legal status of the protected area

management_authority

the management authority

governance

the type of gouvernance

management_plan

the URL of the management plan

protected_planet

the URL of the protected area page on the Protected Planet website

legal_status_updated

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

Note that some geometries are POINTS not (MULTIPOLYGONS).

See Also

wdpa_countries, get_countries

Examples

## 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)

World Countries Listed in the UNEP-WCMC Regions

Description

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.

Usage

wdpa_countries

Format

A data frame with 248 rows (countries) and the following 5 columns:

region_name

the name of the region

region_iso2

the ISO-2 code of the region

country_name

the name of the country

country_iso3

the ISO-3 code of the country

pas_count

the number of protected areas per country

Source

https://www.protectedplanet.net/c/unep-regions