Skip to main content

Forest cover change from Google Earth Engine

Project description

Logo geefcc

geefcc Python package

Python version PyPI version GitHub Actions License GPLv3 Zenodo

Overview

The geefcc Python package can be used to make forest cover change (fcc) maps from Google Earth Engine (GEE) and download them locally. Forest cover change maps are obtained from two global tree/forest cover change products: Global Forest Change or Tropical Moist Forests. These two products are derived from the Landsat satellite image archive and provide tree/forest cover data at 30 m resolution.

banner_geefcc

The geefcc package depends on the xee Python package, which allows opening GEE datasets locally without exporting data to GEE assets or Google Drive. The user only has to specify an area of interest (aoi), either with an extent, a polygon vector file, or a country iso code (e.g. PER for Peru), and the years defining the time periods considered for the forest cover change (e.g. 2000, 2010, 2020). For the Global Forest Change product, the users also has to specify a tree cover threshold to define the forest (e.g. 75%).

Prerequisites

Access to Google Earth Engine

To use the geefcc Python package, you need a Google account and an access to Earth Engine either via a Google Cloud project that’s registered to use Earth Engine or via an individually signed-up account. Please follow this link to register for Earth Engine.

You must always initialize GEE before using geefcc functions specifying a Google Cloud project name and Earth Engine high-volume endpoint:

ee.Initialize(
  credentials=credentials,
  project=project,
  opt_url="https://earthengine-highvolume.googleapis.com"
)

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.

GADM website

The geefcc package downloads country administrative borders from the GADM website. From time to time, their server is not responding. In case of problem with downloading country borders, check directly on the GADM website that data can be downloaded manually to be sure that the problem is coming from geefcc.

Installation

The easiest way to install the geefcc 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 installing geefcc with pip:

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

Install Python dependencies and geefcc 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 geefcc. This will install all other dependencies
python3 -m pip install geefcc

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

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

To deactivate and delete the virtual environment:

deactivate
rm -R ~/venvs/venv-geefcc # 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 geefcc 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geefcc-0.1.4.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

geefcc-0.1.4-py2.py3-none-any.whl (32.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file geefcc-0.1.4.tar.gz.

File metadata

  • Download URL: geefcc-0.1.4.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for geefcc-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c73db9e436a69306b07ab8ca8347886c8e86439d8738946c5479853736a7030d
MD5 aa4b22dbf2f067e14e53b952fa724b36
BLAKE2b-256 451d2aca4f333bdbd508008af55d52a28415e72a299e8ab94f908e962017e5c8

See more details on using hashes here.

File details

Details for the file geefcc-0.1.4-py2.py3-none-any.whl.

File metadata

  • Download URL: geefcc-0.1.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for geefcc-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 64eb7c76d0faa216c2b4a2433dd400309d41b01331e4021513c7200f374a820d
MD5 8df82434ef46ed4700be94229299c609
BLAKE2b-256 a9128d02a01823e6e02358e0a070807d3aca33b18e1d3e23957a9d0564696a97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page