Skip to main content
Logo pywdpa

pywdpa Python package

Python version PyPI version GitHub Actions License GPLv3 Zenodo

Overview

The pywdpa Python package is an interface to the World Database on Protected Areas (WDPA) hosted on the Protected Planet website at https://www.protectedplanet.net. The pywdpa package provides functions to download shapefiles of protected areas (PA) for any countries with an iso3 code using the Protected Planet API at https://api.protectedplanet.net. The pywdpa package translates some functions of the R package worldpa (https://github.com/FRBCesab/worldpa) in the Python language.

protected-planet

Terms and conditions

You must ensure that the following citation is always clearly reproduced in any publication or analysis involving the Protected Planet Materials in any derived form or format:

UNEP-WCMC and IUCN (YEAR) Protected Planet: The World Database on Protected Areas (WDPA). Cambridge, UK: UNEP-WCMC and IUCN. Available at: www.protectedplanet.net (dataset downloaded the YEAR/MONTH).

For further details on terms and conditions of the WDPA usage, please visit the page: https://www.protectedplanet.net/en/legal.

Prerequisites

Access to Protected Planet API

This package uses the Protected Planet API to access data on world protected areas. You must first have obtained a Personal API Token by filling in the form available at https://api.protectedplanet.net/request. Then you need to set an environment variable (we recommend using the name WDPA_KEY) using either the command os.environ["WDPA_KEY"]="your_token" or python-dotenv.

GDAL

GDAL must be installed on your system.

To install GDAL on Windows, use the OSGeo4W network installer. OSGeo4W is a binary distribution of a broad set of open source geospatial software for Windows environments (Windows 11 down to 7). Select Express Install and install GDAL. Several Gb of space will be needed on disk to install this programs. This will also install OSGeo4W Shell to execute command lines.

To install GDAL on other systems, use your package manager, for example apt for Debian/Ubuntu Linux distributions.

sudo apt update
sudo apt install gdal-bin libgdal-dev

After installing GDAL, you can test the installation by running gdalinfo --version in the command prompt or terminal, which should display the installed GDAL version.

Installation

The easiest way to install the pywdpa Python package is via pip in the OSGeo4W Shell for Windows or in a virtual environment for Linux.

For Linux, create and activate a virtual environment before install pywdpa with pip:

cd ~
# Create a directory for virtual environments
mkdir venvs
# Create the virtual environment with venv
python3 -m venv ~/venvs/venv-pywdpa
# Activate (start) the virtual environment
source ~/venvs/venv-pywdpa/bin/activate

Install Python dependencies and pywdpa in the OSGeo4W Shell or in the newly created virtual environment:

# Upgrade pip, setuptools, and wheel
python3 -m pip install --upgrade pip setuptools wheel
# Install numpy
python3 -m numpy
# Install gdal Python bindings (the correct version)
python3 -m pip install gdal==$(gdal-config --version)
# Install pywdpa. This will install all other dependencies
python3 -m pip install pywdpa

If you want to install the development version of pywdpa, replace the last line with:

python3 -m pip install https://github.com/ghislainv/pywdpa/archive/master.zip

To deactivate and delete the virtual environment:

deactivate
rm -R ~/venvs/venv-pywdpa # Just remove the repository

In case of problem while installing GDAL Python bindings, try the following command:

python3 -m pip install  --no-cache-dir --force-reinstall gdal==$(gdal-config --version)

Contributing

The pywdpa Python package is Open Source and released under the GNU GPL version 3 license. Anybody who is interested can contribute to the package development following our Community guidelines. Every contributor must agree to follow the project’s Code of conduct.

Metadata

Release files for pywdpa 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywdpa 0.1.6
File Size Uploaded
pywdpa-0.1.6.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywdpa 0.1.6
File Interpreter ABI Platform
pywdpa-0.1.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 43.3 kB

Release files / pywdpa-0.1.6.tar.gz

Download URL pywdpa-0.1.6.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
898603da8bc25d288db9dbf5537cf46d8d7c953b5a6b0348422aa912a0e80ff5
BLAKE2b-256 checksum
How to use checksums
b38f706c3d4679fd3c4a5c6c4a3c18ec500d88bd9d3e45ffa6fd522499257803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / pywdpa-0.1.6-py2.py3-none-any.whl

Download URL pywdpa-0.1.6-py2.py3-none-any.whl
Size 20.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cac4c0dc6ba9e61ac39fdcf1894756dc1ab264b66aa4da716c052f9b6803b68a
BLAKE2b-256 checksum
How to use checksums
a280d66146e188e9d7552bbff2ec631638a3c2e66f699a839baa27f66e8d72da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

3 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page