mapchete 2025.5.2


pip install mapchete

  Latest version

Released: May 22, 2025

Project Links

Meta
Author: Joachim Ungar

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

License
  • OSI Approved :: MIT License

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12

Topic
  • Scientific/Engineering :: GIS
logo/mapchete.svg

Tile-based geodata processing.

https://badge.fury.io/py/mapchete.svg https://github.com/ungarj/mapchete/actions/workflows/python-package.yml/badge.svg Documentation Status https://img.shields.io/pypi/pyversions/mapchete.svg

Mapchete processes raster and vector geodata in digestable chunks.

Processing larger amounts of data requires chunking the input data into smaller tiles and process them one by one. Python provides a lot of useful packages to process geodata like shapely or numpy. From within your process code you will have access to the geodata in the form of NumPy arrays for raster data or GeoJSON-like feature dictionaries for vector data.

Internally the processing job is split into tasks which can processed in parallel using either concurrent.futures or build task graphs and use dask to intelligently process either on the local machine or on a cluster.

With the help of fiona and rasterio Mapchete takes care about resampling and reprojecting geodata, applying your Python code to the tiles and writing the output either into a single file or into a directory of files organized in a WMTS-like tile pyramid. Details on tiling scheme and available map projections are outlined in the tiling documentation.

https://mapchete.readthedocs.io/en/latest/_images/mercator_pyramid.svg

(standard Web Mercator pyramid used in the web)

Usage

You need a .mapchete file for the process configuration. The configuration is based on the YAML syntax.

process: my_python_process.py  # or a Python module path: mypythonpackage.myprocess
zoom_levels:
    min: 0
    max: 12
input:
    dem: /path/to/dem.tif
    land_polygons: /path/to/polygon/file.geojson
output:
    format: PNG_hillshade
    path: /output/path
pyramid:
    grid: mercator

# process specific parameters
resampling: cubic_spline

You also need either a .py file or a Python module path where you specify the process itself.

def execute(mp, resampling="nearest"):

    # Open elevation model.
    with mp.open("dem") as src:
        # Skip tile if there is no data available or read data into a NumPy array.
        if src.is_empty(1):
            return "empty"
        else:
            dem = src.read(1, resampling=resampling)

    # Create hillshade using a built-in hillshade function.
    hillshade = mp.hillshade(dem)

    # Clip with polygons from vector file and return result.
    with mp.open("land_polygons") as land_file:
        return mp.clip(hillshade, land_file.read())

You can then interactively inspect the process output directly on a map in a browser (first, install dependencies by pip install mapchete[serve] go to localhost:5000):

$ mapchete serve hillshade.mapchete --memory

The serve tool recognizes changes in your process configuration or in the process file. If you edit one of these, just refresh the browser and inspect the changes (note: use the --memory flag to make sure to reprocess each tile and turn off browser caching).

Once you are done with editing, batch process everything using the execute tool.

$ mapchete execute hillshade.mapchete

Documentation

There are many more options such as zoom-dependent process parameters, metatiling, tile buffers or interpolating from an existing output of a higher zoom level. For deeper insights, please go to the documentation.

Mapchete is used in many preprocessing steps for the EOX Maps layers:

  • Merge multiple DEMs into one global DEM.

  • Create a customized relief shade for the Terrain Layer.

  • Generalize landmasks & coastline from OSM for multiple zoom levels.

  • Extract cloudless pixel for Sentinel-2 cloudless.

Installation

via PyPi:

$ pip install mapchete

from source:

$ git clone git@github.com:ungarj/mapchete.git && cd mapchete
$ pip install .

To make sure Rasterio, Fiona and Shapely are properly built against your local GDAL and GEOS installations, don’t install the binaries but build them on your system:

$ pip install --upgrade rasterio fiona shapely --no-binary :all:

To keep the core dependencies minimal if you install mapchete using pip, some features are only available if you manually install additional dependencies:

# for contour extraction:
$ pip install mapchete[contours]

# for dask processing:
$ pip install mapchete[dask]

# for S3 bucket reading and writing:
$ pip install mapchete[s3]

# for mapchete serve:
$ pip install mapchete[serve]

# for VRT generation:
$ pip install mapchete[vrt]

License

MIT License

Copyright (c) 2015 - 2022 EOX IT Services

2025.5.2 May 22, 2025
2025.5.1 May 20, 2025
2025.5.0 May 07, 2025
2025.4.0 Apr 09, 2025
2025.3.1 Mar 31, 2025
2025.3.0 Mar 26, 2025
2025.1.1 Jan 27, 2025
2025.1.0 Jan 14, 2025
2024.12.0 Dec 03, 2024
2024.11.1 Nov 25, 2024
2024.11.0 Nov 05, 2024
2024.10.1 Oct 29, 2024
2024.10.0 Oct 28, 2024
2024.9.0 Sep 11, 2024
2024.7.1 Jul 25, 2024
2024.7.0 Jul 24, 2024
2024.6.0 Jun 03, 2024
2024.5.2 May 15, 2024
2024.5.1 May 15, 2024
2024.5.0 May 02, 2024
2024.2.1 Feb 20, 2024
2024.2.0 Feb 14, 2024
2024.1.3 Jan 15, 2024
2024.1.2 Jan 11, 2024
2024.1.1 Jan 11, 2024
2024.1.0 Jan 04, 2024
2023.12.3 Dec 15, 2023
2023.12.2 Dec 12, 2023
2023.12.1 Dec 07, 2023
2023.12.0 Dec 05, 2023
2023.11.0 Nov 20, 2023
2023.10.0 Oct 18, 2023
2023.9.1 Sep 19, 2023
2023.9.0 Sep 05, 2023
2023.8.1 Aug 09, 2023
2023.8.0 Aug 09, 2023
2023.7.1 Jul 18, 2023
2023.7.0 Jul 04, 2023
2023.6.5 Jun 14, 2023
2023.6.4 Jun 13, 2023
2023.6.3 Jun 12, 2023
2023.6.2 Jun 12, 2023
2023.6.1 Jun 06, 2023
2023.6.0 Jun 05, 2023
2023.4.1 Apr 20, 2023
2023.4.0 Apr 20, 2023
2023.1.1 Jan 26, 2023
2023.1.0 Jan 03, 2023
2022.12.1 Dec 20, 2022
2022.12.0 Dec 16, 2022
2022.11.2 Nov 30, 2022
2022.11.1 Nov 23, 2022
2022.11.0 Nov 21, 2022
2022.9.2 Sep 16, 2022
2022.9.1 Sep 15, 2022
2022.9.0 Sep 14, 2022
2022.7.0 Jul 11, 2022
2022.6.0 Jun 10, 2022
2022.4.1 Apr 28, 2022
2022.4.0 Apr 01, 2022
2022.3.3 Mar 30, 2022
2022.3.1 Mar 11, 2022
2022.3.0 Mar 09, 2022
2022.2.2 Feb 25, 2022
2022.2.1 Feb 23, 2022
2022.2.0 Feb 03, 2022
2022.1.2 Jan 31, 2022
2022.1.1 Jan 19, 2022
2022.1.0 Jan 19, 2022
2021.12.3 Dec 16, 2021
2021.12.2 Dec 14, 2021
2021.12.1 Dec 14, 2021
2021.12.0 Dec 02, 2021
2021.11.3 Nov 23, 2021
2021.11.2 Nov 16, 2021
2021.11.1 Nov 16, 2021
2021.11.0 Nov 03, 2021
2021.10.3 Oct 19, 2021
2021.10.2 Oct 19, 2021
2021.10.1 Oct 08, 2021
2021.10.0 Oct 01, 2021
0.44 Sep 30, 2021
0.43 Sep 17, 2021
0.42 Aug 27, 2021
0.41 Aug 17, 2021
0.40 Jun 24, 2021
0.39 Jun 08, 2021
0.38 Dec 10, 2020
0.37 Nov 25, 2020
0.36 Nov 24, 2020
0.35 Aug 04, 2020
0.34 Jul 08, 2020
0.33 Mar 24, 2020
0.32 Feb 24, 2020
0.31 Dec 03, 2019
0.30 Oct 22, 2019
0.29 Jul 12, 2019
0.28 Jun 18, 2019
0.27 Jan 03, 2019
0.26 Nov 28, 2018
0.25 Oct 29, 2018
0.24 Oct 23, 2018
0.23 Aug 21, 2018
0.22 May 31, 2018
0.21 May 31, 2018
0.20 Apr 07, 2018
0.19 Feb 16, 2018
0.18 Feb 02, 2018
0.17 Feb 02, 2018
0.16 Jan 12, 2018
0.14 Jan 02, 2018
0.13 Dec 21, 2017
0.12 Nov 23, 2017
0.11 Nov 09, 2017
0.10 Oct 23, 2017
0.9 Oct 04, 2017
0.8 Sep 22, 2017
0.7 Sep 20, 2017
0.6 Sep 12, 2017
0.5 May 07, 2017
0.4 Mar 02, 2017
0.3 Sep 20, 2016
0.2 Sep 07, 2016
0.1 Aug 23, 2016
0.0.1 Feb 04, 2016
0.0rc0 Nov 28, 2018

Wheel compatibility matrix

Platform Python 2 Python 3
any

Files in release

Extras:
Dependencies:
aiohttp
cachetools
click-plugins
click-spinner
click (>=7.1.1)
dask
distributed
fiona (>=1.8.13.post1)
fsspec
geojson-pydantic
importlib-metadata
importlib-resources
numpy (!=2.0.1,>=1.16)
oyaml
pydantic-settings (>=2.0.0)
pydantic (>=2.3.0)
pyproj
python-dateutil
rasterio (>1.2.10)
retry
shapely (>=2.0.0)
tilematrix (>=2022.12.0)
tqdm