Skip to main content

PMTiles-MBTiles-Util

PMTiles-MBTiles-Util is a utility for importing, exporting, and converting between the MBTiles and PMTiles archive formats, as well as flat directory tile structures on disk. It provides the pmtiles-mbtiles-util command.


⚙️ Capabilities

  • Format Conversion: Directly convert .mbtiles to .pmtiles and vice versa.
  • MBTiles Support: Full import/export support for the MBTiles SQLite-based tile archive format.
  • PMTiles Support: Full import/export and direct conversion support for the PMTiles single-file tile archive format.
  • Disk Export: Extract tiles from an archive to a standard directory structure (XYZ, TMS, etc.).
  • Disk Import: Pack a directory of tiles into a single portable archive.
  • Deduplication: Use hash-based compression to reduce file sizes for repetitive maps (e.g., oceans or vector data).

📦 Installation

pip install pmtiles-mbtiles-util

The name differs from the upstream project it forks. mbutil on PyPI belongs to the original, now-archived Mapbox project, and PyPI rejects mb-util too as being too similar to it. The command and the import package match the distribution, so nothing is shared with the original:

This project mapbox/mbutil
Distribution pmtiles-mbtiles-util mbutil
Command pmtiles-mbtiles-util mb-util
Import pmtiles_mbtiles_util mbutil

From source

git clone https://github.com/TechIdiots-LLC/pmtiles-mbtiles-util.git
cd pmtiles-mbtiles-util

# Install the pmtiles-mbtiles-util command globally
pip install .

Docker

PMTiles-MBTiles-Util is also available as a Docker image. See DOCKER.md for usage instructions.


🛠 Usage

pmtiles-mbtiles-util [options] <input> <output>

Quick Examples

Action Command
Convert MBTiles to PMTiles pmtiles-mbtiles-util world.mbtiles world.pmtiles
Convert PMTiles to MBTiles pmtiles-mbtiles-util world.pmtiles world.mbtiles
Extract to Directory pmtiles-mbtiles-util world.pmtiles ./tiles_dir
Import from Directory pmtiles-mbtiles-util ./tiles_dir world.mbtiles
Dump Metadata pmtiles-mbtiles-util world.pmtiles dumps

Options

Option Description
-h, --help Show help message and exit
--scheme=SCHEME Tiling scheme: xyz (default), tms, wms, zyx, ags, gwc
--image_format=FORMAT Tile format: png, jpg, webp, pbf, mvt, mlt
--do_compression Enable hash-based tile deduplication when writing to MBTiles (has no effect for PMTiles or disk output)
--hash_type=TYPE Algorithm for deduplication: fnv1a (fastest, default), sha256, sha256_truncated, md5
--silent Disable progress logging for faster execution

💎 Tile Deduplication

Deduplication behaviour varies by output format:

  • MBTiles output: Use --do_compression to enable hash-based deduplication. Identical tiles are stored only once with internal references, which can significantly reduce file size for repetitive maps (e.g. ocean tiles, empty areas, vector data).
  • PMTiles output: Deduplication is built into the PMTiles format and happens automatically. --do_compression is not needed and has no effect.
  • Disk output: No deduplication — each tile is written as an individual file.
# Deduplicate when writing to MBTiles
pmtiles-mbtiles-util --do_compression --hash_type sha256_truncated ./my_tiles world.mbtiles

Hash Types

Hash Type Bits Speed Best For
fnv1a (default) 64 Fastest General use
sha256_truncated 64 Medium Balanced performance
sha256 256 Medium Maximum collision resistance
md5 128 Fast Legacy compatibility

⚡ Performance & Large Files

  • Deduplication: Use --do_compression when writing to MBTiles to reduce file size for repetitive content. PMTiles handles deduplication automatically.
  • Silent mode: Use --silent to skip progress logging for a small speed boost.
  • Temporary Storage: When converting to PMTiles, the utility writes a temporary file during conversion. By default this goes to /tmp, which on some Linux systems is RAM-backed (tmpfs). For very large files, redirect it to a physical disk:
TMPDIR=/mnt/external_drive/tmp pmtiles-mbtiles-util world.mbtiles world.pmtiles

The temp file grows to roughly the same size as the output PMTiles archive and is deleted automatically when conversion completes.


🔗 Specifications & Resources


🧪 Testing

Tests use Python's built-in unittest and are compatible with both pytest (recommended) and nosetests.

# Using pytest (recommended)
pip install pytest
pytest test/

# Using unittest directly
python -m unittest discover test/

# Using nosetests (legacy)
pip install nose
nosetests

Test files:

  • test/test.py — MBTiles import/export tests
  • test/test_pmtiles.py — PMTiles conversion and roundtrip tests

📄 License

BSD — See LICENSE.md for details.


👥 Authors

Metadata

Release files for pmtiles-mbtiles-util 1.1.0

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

Source distribution (sdist)

Source distribution for pmtiles-mbtiles-util 1.1.0
File Size Uploaded
pmtiles_mbtiles_util-1.1.0.tar.gz 25.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pmtiles-mbtiles-util 1.1.0
File Interpreter ABI Platform
pmtiles_mbtiles_util-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.2 kB

Release files / pmtiles_mbtiles_util-1.1.0.tar.gz

Download URL pmtiles_mbtiles_util-1.1.0.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4ab76ee6ada345934970cbd78de72d63a0475c01fd908f5e12987f1eeb971f2f
BLAKE2b-256 checksum
How to use checksums
028101cd5854eb395e4e5d93eec4c8d9de6dc072d70bf0abf8dbf696396691eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / pmtiles_mbtiles_util-1.1.0-py3-none-any.whl

Download URL pmtiles_mbtiles_util-1.1.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
931c481e3dc3f2b66d20211a5df4b59a11a6e645a44ccb91c6cd7c03fc985bca
BLAKE2b-256 checksum
How to use checksums
cf1002e5ddafdf3d53ec79ba3fb6b322df124a99cbbc769d559ca2e8fe0bb70f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

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