Terragon

Terragon - Earth(Poly)gon. Create EO Minicubes from Polygons and simplify EO Data downloading.

Documentation GitHub

PyPI License

You want to download Earth Observation data but don’t want to spend hours just for accessing all different APIs? Then this is for you!

We currently support these data providers:

Usage

Installation

Install the package via PyPi:

pip install "terragon-downloader"

Optional with the dependency you want to use:

pip install "terragon-downloader[pc]"

Downloading EO data

import terragon
import geopandas as gpd
from shapely.geometry import Polygon

# example polygon
gdf = gpd.GeoDataFrame(geometry=[Polygon(
            [(446993, 3383569),
            (446993, 3371569),
            (434993, 3371569),
            (434993, 3383569),
            (446993, 3383569)])],
            crs='EPSG:32616' # the dataset will receive the crs from the dataframe
            )

# initialize backend/data source (here planetary computer)
tg = terragon.init('pc')

# download data
da = tg.create(shp=gdf, # polygon in geopandas format (minicube will receive the same CRS)
               collection="sentinel-2-l2a", # name of the collection
               start_date="2021-01-01", # start date of tiles
               end_date="2021-01-05", # end date of tiles
               bands=["B02", "B03", "B04"], # bands to retrieve
               resolution=20, # pixel size in meter
               )

Other data backends work with the same principle, some may require an account, check out the Demos.

Limitations

Users must provide authentication (if required) for the data providers to Terragon and must comply with their licensing agreements. Instructions on how to create accounts and the necessary information for each data provider can be found in the Demos.

This library relies on external data providers. Therefore, the reproducibility cannot be guaranteed and depends on the providers. Users should ensure they check the relevant license terms for data and services and cite them appropriately. The data offered may also vary across providers. It is important to note that each provider operates independently and utilizes different processing pipelines. This can result in various products that may not be compatible with one another, even if their collections share a similar name on the platforms of the data providers. Additionally, certain data or patches may be available from some providers but not from others. This includes mosaicking, which depends on the chosen collection and is not handled by this library.

Contribute

You found a bug or a data source is missing? We encourage you to raise an issue or provide a PR. For details, please see the contributing guideline.

We are looking for contributors to add more collections to CDSE. Please get in touch if you are interested.

License

This work is licensed under the MIT license.

Citation

If you use this work, please consider citing the following paper: Coming soon.

Acknowledgement

This work is inspired by cubo