wdpar
R Interface to the World Database on Protected Areas.
https://github.com/prioritizr/wdpar
Category: Biosphere
Sub Category: Conservation and Restoration
Keywords
biodiversity conservation cran data database protected-areas r r-package rstats spatial
Last synced: about 21 hours ago
JSON representation
Repository metadata
Interface to the World Database on Protected Areas
- Host: GitHub
- URL: https://github.com/prioritizr/wdpar
- Owner: prioritizr
- License: gpl-3.0
- Created: 2017-12-14T04:33:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-18T05:31:26.000Z (7 months ago)
- Last Synced: 2025-10-26T02:41:47.086Z (8 days ago)
- Topics: biodiversity, conservation, cran, data, database, protected-areas, r, r-package, rstats, spatial
- Language: R
- Homepage: https://prioritizr.github.io/wdpar
- Size: 32.9 MB
- Stars: 41
- Watchers: 2
- Forks: 5
- Open Issues: 0
- Releases: 7
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
README.Rmd
---
output:
rmarkdown::github_document:
html_preview: no
---
```{r, include = FALSE}
knitr::opts_chunk$set(fig.path = "man/figures/README-", fig.align = "center",
fig.height = 4.5, fig.width = 4.5)
```
## wdpar: Interface to the World Database on Protected Areas
[](https://lifecycle.r-lib.org/articles/stages.html)
[](https://github.com/prioritizr/wdpar/actions)
[](https://github.com/prioritizr/wdpar/actions)
[](https://github.com/prioritizr/wdpar/actions)
[](https://github.com/prioritizr/wdpar/actions)
[](https://app.codecov.io/gh/prioritizr/wdpar/branch/master)
[](https://CRAN.R-project.org/package=wdpar)
```{r, include = FALSE}
devtools::load_all()
```
### Overview
[Protected Planet](https://www.protectedplanet.net/en) provides the most comprehensive data for conservation areas worldwide. Specifically, it provides the World Database on Protected Areas (WDPA) and the World Database on Other Effective Area-Based Conservation Measures (WDOECM). These databases are used to monitor the performance of existing protected areas, and identify priority areas for future conservation efforts. Additionally, these databases receive monthly updates from government agencies and non-governmental organizations. However, they are associated with [several issues that need to be addressed prior to analysis](https://www.protectedplanet.net/en/resources/calculating-protected-area-coverage) and the dynamic nature of these databases means that the entire data cleaning process needs to be repeated after obtaining a new version.
The _wdpar R_ package provides an interface to data provided by [Protected Planet](https://www.protectedplanet.net/en). Specifically, the package can automatically obtain data from the [World Database on Protected Areas (WDPA)](https://www.protectedplanet.net/en/thematic-areas/wdpa?tab=WDPA) and the [World Database on Other Effective Area-Based Conservation Measures (WDOECM)](https://www.protectedplanet.net/en/thematic-areas/oecms). It also provides methods for cleaning data from these databases following best practices (outlined in [Butchart *et al.* 2015](https://doi.org/10.1111/conl.12158); [Protected Planet 2021](https://www.protectedplanet.net/en/resources/calculating-protected-area-coverage); [Runge *et al.* 2015](https://doi.org/10.1126/science.aac9180)). The main functions are `wdpa_fetch()` for downloading data and `wdpa_clean()` for cleaning data. For more information, please see the package vignette.
### Installation
#### Package installation
The [latest official version of the _wdpar R_ package](https://CRAN.R-project.org/package=wdpar) can be installed using the following R code. Please note that this package requires the [_curl_](https://github.com/jeroen/curl) and [_sf R_](https://github.com/r-spatial/sf) packages which may require additional software to be installed. If you encounter problems installing the _wdpar R_ package, please consult the installation instructions for these packages.
```{r, eval = FALSE}
install.packages("wdpar", repos = "https://cran.rstudio.com/")
```
Alternatively, the latest developmental version can be installed using the following _R_ code. Please note that while developmental versions may contain additional features not present in the official version, they may also contain coding errors.
```{r, eval = FALSE}
if (!require(remotes)) install.packages("remotes")
remotes::install_github("prioritizr/wdpar")
```
#### Additional dependencies
The _wdpar R_ package can leverage the _prepr R_ package to augment data cleaning procedures. Since the _prepr R_ package is not available on the Comprehensive R Archive Network, it is listed as an optional dependency. In some cases, the _prepr R_ package is required to complete the data cleaning procedures (e.g. to fix especially extreme geometry issues) and the _wdpar R_ package will throw an error if the package is not available. To install the _prepr R_ package, please use the following R code.
```{r, eval = FALSE}
if (!require(remotes)) install.packages("remotes")
remotes::install_github("prioritizr/prepr")
```
Note that the _prepr R_ package has system dependencies that need to be installed before the package itself can be installed (see below for platform-specific instructions).
##### _Windows_
A Chromium-based web browser to be installed (e.g., Google Chrome, Chromium, Brave). Also, the [Rtools](https://cran.r-project.org/bin/windows/Rtools/) software needs to be installed to install the _prepr R_ package package from source. This software provides system requirements from [rwinlib](https://github.com/rwinlib/).
##### _Ubuntu_
A Chromium-based web browser must to be installed (e.g., Google Chrome, Chromium, Brave). Also, the `gmp`, `mpfr`, and several spatial libraries need to be installed. For recent versions of Ubuntu (18.04 and later), these libraries are available through official repositories. They can be installed using the following system commands:
```
apt-get -y update
apt-get install -y libgmp3-dev libmpfr-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev chromium-browser
```
##### _Linux_
For Unix-alikes, a Chromium-based web browser (e.g., Google Chrome, Chromium, Brave), `gmp` (>= 4.2.3), `mpfr` (>= 3.0.0), and `gdal` (>= 3.2.2) are required.
##### _macOS_
A Chromium-based web browser to be installed (e.g., Google Chrome, Chromium, Brave). Also, the `gmp`, `mpfr`, and `gdal` libraries are required. The easiest way to install these libraries is using [HomeBrew](https://brew.sh/). After installing HomeBrew, these libraries can be installed using the following commands in the system terminal:
```
brew install pkg-config
brew install gmp
brew install mpfr
brew install gdal
brew install --cask chromium
```
### Usage
Here we will provide a short introduction to the _wdpar R_ package. First, we will load the _wdpar R_ package. We will also load the _dplyr_ and _ggmap R_ packages to help explore the data.
```{r, message = FALSE, warning = FALSE}
# load packages
library(wdpar)
library(dplyr)
library(ggmap)
```
Now we will download protected area data for Malta from [Protected Planet](https://www.protectedplanet.net/en). We can achieve this by specifying Malta's country name (i.e. `"Malta"`) or Malta's [ISO3 code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) (i.e. `"MLT"`). Since data are downloaded to a temporary directory by default, we will specify that the data should be downloaded to a persistent directory. This means that R won't have to re-download the same dataset every time we restart our R session, and R can simply re-load previously downloaded datasets as needed.
```{r, include = FALSE}
# download protected area data for Malta
mlt_raw_pa_data <- wdpa_fetch("Malta", wait = TRUE, force = TRUE)
```
```{r, eval = FALSE}
# download protected area data for Malta
mlt_raw_pa_data <- wdpa_fetch("Malta", wait = TRUE,
download_dir = rappdirs::user_data_dir("wdpar"))
```
Next, we will clean the data set. Briefly, the cleaning steps include: excluding protected areas that are not yet implemented, excluding protected areas with limited conservation value, replacing missing data codes (e.g. `"0"`) with missing data values (i.e. `NA`), replacing protected areas represented as points with circular protected areas that correspond to their reported extent, repairing any topological issues with the geometries, and erasing overlapping areas. For more information, see `?wdpa_clean`.
```{r}
# clean Malta data
mlt_pa_data <- wdpa_clean(mlt_raw_pa_data)
```
Print preview of the data associated with each protected area.
```{r}
# print preview
head(mlt_pa_data)
```
Finally, after cleaning the data, let's plot a map showing Malta's protected areas and color each area according to its management category ([as defined by the The International Union for Conservation of Nature](https://iucn.org/)).
```{r "readme-map", message = FALSE, warning = FALSE, out.width = ifelse(isTRUE(knitr:::is_html_output(excludes = c("markdown"))), "60%", "50%")}
# reproject data to longitude/latitude for plotting
mlt_pa_data <- st_transform(mlt_pa_data, 4326)
# download basemap imagery
bg <- get_stadiamap(
unname(st_bbox(mlt_pa_data)), zoom = 8,
maptype = "stamen_terrain_background", force = TRUE
)
# make map
ggmap(bg) +
geom_sf(aes(fill = IUCN_CAT), data = mlt_pa_data, inherit.aes = FALSE) +
theme(axis.title = element_blank(), legend.position = "bottom")
```
If you need to calculate protected area coverage statistics for a country, please note that you will need to manually clip the cleaned protected area data to the countries' coastline and its Exclusive Economic Zone (EEZ) to obtain accurate results (see [official data cleaning guidelines](https://www.protectedplanet.net/en/resources/calculating-protected-area-coverage)). This step is not performed by the _wdpar R_ package because there is no single "best" coastline and Exclusive Economic Zone (EEZ) dataset, since the "best" dataset for any given project depends on the level of required precision and available computational resources. For more examples---including an example of clipping the cleaned data to a coastline---please refer to the [package vignette](https://prioritizr.github.io/wdpar/articles/wdpar.html).
### Citation
Please cite the _wdpar R_ package and the relevant databases used in publications.
To cite the package, please use:
> Hanson JO (2022) wdpar: Interface to the World Database on Protected Areas. Journal of Open Source Software, 7: 4594. Available at .
To cite the World Database on Protected Areas (WDPA), please use:
```{r, echo = FALSE, results = "asis", comment = ""}
cat(paste0("> 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:
```{r, echo = FALSE, results = "asis", comment = ""}
cat(paste0("> UNEP-WCMC and IUCN ([insert year of the version downloaded]) Protected Planet: The world database on other effective area-based conservation measures, [insert month/year of the version downloaded], Cambridge, UK: UNEP-WCMC and IUCN. Available at: www.protectedplanet.net."))
```
Owner metadata
- Name: prioritizr
- Login: prioritizr
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/25472841?v=4
- Repositories: 23
- Last ynced at: 2023-11-21T03:20:14.104Z
- Profile URL: https://github.com/prioritizr
GitHub Events
Total
- Issues event: 13
- Watch event: 3
- Delete event: 2
- Issue comment event: 32
- Push event: 13
- Pull request event: 6
- Create event: 3
Last Year
- Issues event: 13
- Watch event: 2
- Delete event: 2
- Issue comment event: 32
- Push event: 13
- Pull request event: 6
- Create event: 3
Committers metadata
Last synced: 3 days ago
Total Commits: 300
Total Committers: 2
Avg Commits per committer: 150.0
Development Distribution Score (DDS): 0.003
Commits in past year: 4
Committers in past year: 1
Avg Commits per committer in past year: 4.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| jeffreyhanson | j****n@u****u | 299 |
| Jason Everett | J****t@u****u | 1 |
Committer domains:
- unsw.edu.au: 1
- uqconnect.edu.au: 1
Issue and Pull Request metadata
Last synced: 21 days ago
Total issues: 62
Total pull requests: 33
Average time to close issues: about 2 months
Average time to close pull requests: 4 days
Total issue authors: 34
Total pull request authors: 2
Average comments per issue: 6.16
Average comments per pull request: 1.09
Merged pull request: 30
Bot issues: 0
Bot pull requests: 0
Past year issues: 6
Past year pull requests: 7
Past year average time to close issues: 16 days
Past year average time to close pull requests: 1 day
Past year issue authors: 6
Past year pull request authors: 1
Past year average comments per issue: 4.17
Past year average comments per pull request: 1.0
Past year merged pull request: 7
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- jeffreyhanson (14)
- Jo-Schie (6)
- JonasGeschke (5)
- sahmoli (2)
- Va99le (2)
- JocelyneSze (2)
- DrMattG (2)
- edzer (2)
- carbonmetrics (2)
- ankemueller (1)
- ajpelu (1)
- urskalbitzer (1)
- fabeit (1)
- courtiol (1)
- jcvdav (1)
Top Pull Request Authors
- jeffreyhanson (37)
- jaseeverett (2)
Top Issue Labels
- bug (23)
- enhancement (9)
- question (4)
Top Pull Request Labels
- bug (1)
Package metadata
- Total packages: 3
-
Total downloads:
- cran: 1,430 last-month
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 3 (may contain duplicates)
- Total versions: 26
- Total maintainers: 1
proxy.golang.org: github.com/prioritizr/wdpar
- Homepage:
- Documentation: https://pkg.go.dev/github.com/prioritizr/wdpar#section-documentation
- Licenses: gpl-3.0
- Latest release: v1.3.7 (published about 2 years ago)
- Last Synced: 2025-10-31T05:09:49.239Z (3 days ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.395%
- Average: 5.576%
- Dependent repos count: 5.758%
cran.r-project.org: wdpar
Interface to the World Database on Protected Areas
- Homepage: https://prioritizr.github.io/wdpar/
- Documentation: http://cran.r-project.org/web/packages/wdpar/wdpar.pdf
- Licenses: GPL-3
- Latest release: 1.3.8 (published about 1 year ago)
- Last Synced: 2025-10-31T05:10:00.881Z (3 days ago)
- Versions: 17
- Dependent Packages: 0
- Dependent Repositories: 2
- Downloads: 1,430 Last month
-
Rankings:
- Stargazers count: 8.495%
- Downloads: 12.236%
- Average: 17.069%
- Forks count: 17.219%
- Dependent repos count: 19.546%
- Dependent packages count: 27.852%
- Maintainers (1)
conda-forge.org: r-wdpar
- Homepage: https://prioritizr.github.io/wdpar/
- Licenses: GPL-3.0-only
- Latest release: 1.3.2 (published almost 4 years ago)
- Last Synced: 2025-11-01T09:01:52.199Z (2 days ago)
- Versions: 3
- Dependent Packages: 0
- Dependent Repositories: 1
-
Rankings:
- Dependent repos count: 24.103%
- Stargazers count: 43.614%
- Average: 44.555%
- Dependent packages count: 51.54%
- Forks count: 58.962%
Dependencies
- R >= 3.5.0 depends
- sf >= 1.0 depends
- RSelenium >= 1.7.4 imports
- assertthat >= 0.2.0 imports
- cli >= 1.0.1 imports
- countrycode >= 1.1.0 imports
- curl >= 3.2 imports
- httr >= 1.3.1 imports
- lwgeom >= 0.2 imports
- pingr >= 1.1.2 imports
- progress >= 1.2.0 imports
- rappdirs >= 0.3.1 imports
- sp * imports
- tibble >= 2.1.3 imports
- utils * imports
- wdman >= 0.2.4 imports
- xml2 >= 1.2.0 imports
- dplyr >= 1.0.7 suggests
- ggmap >= 2.6.1 suggests
- ggplot2 >= 3.1.0 suggests
- knitr >= 1.2.0 suggests
- prepr >= 0.1.9000 suggests
- ps >= 1.5.0 suggests
- rmarkdown >= 1.10 suggests
- roxygen2 >= 6.1.1 suggests
- testthat >= 2.0.1 suggests
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
Score: 11.674942268423818