Skip to main content

tilepack

CI Docs PyPI Python License: MIT

Pack raster tile folders (TMS or XYZ) into single-file archives (MBTiles / PMTiles) and serve them as TMS and WMTS endpoints over HTTP.

Why

Raster tile folders contain thousands of small PNG files in deeply nested z/x/y directories. This makes them slow to copy, hard to manage, and fragile to transfer. Tilepack solves this by packing tiles into a single archive file while still exposing standard TMS and WMTS HTTP endpoints that clients like QGIS and CesiumForUnreal can consume directly.

Install

Requires Python 3.11+.

pip install tilepack

For development:

git clone https://github.com/ashnair1/tilepack.git
cd tilepack
uv sync --group dev

Usage

Verify tiles

Scan a tile folder or archive and report zoom levels, tile counts, format, and bounds.

tilepack verify ./path/to/tiles      # TMS/XYZ folder
tilepack verify output.mbtiles       # MBTiles archive
tilepack verify output.pmtiles       # PMTiles archive

Convert to archive

The output format is inferred from the file extension. The input tile scheme (TMS or XYZ) is auto-detected, or can be specified explicitly.

# Auto-detect input scheme
tilepack convert ./path/to/tiles output.mbtiles
tilepack convert ./path/to/tiles output.pmtiles

# Specify input scheme explicitly
tilepack convert ./path/to/tiles output.mbtiles --scheme xyz

Serve as TMS + WMTS endpoint

Start a local HTTP server exposing both TMS and OGC WMTS 1.0.0 endpoints from an archive file.

tilepack serve output.mbtiles --port 8000
tilepack serve output.pmtiles --port 8000

TMS endpoints:

  • http://localhost:8000/tilemapresource.xml
  • http://localhost:8000/{z}/{x}/{y}.png

WMTS endpoints:

  • http://localhost:8000/WMTSCapabilities.xml — GetCapabilities
  • http://localhost:8000/wmts/{Layer}/{TileMatrixSet}/{z}/{row}/{col}.png — RESTful tiles
  • http://localhost:8000/wmts?Service=WMTS&Request=GetTile&... — KVP tiles

To load in QGIS: Layer > Add WMS/WMTS Layer > New, set URL to http://localhost:8000/WMTSCapabilities.xml, then Connect and Add.

Validate correctness

Randomly sample tiles from the original folder, fetch them from the running server, and verify byte-exact matches.

# Start the server in one terminal, then in another:
tilepack selftest ./path/to/tiles --base-url http://127.0.0.1:8000 --samples 200

MBTiles vs PMTiles

MBTiles PMTiles
Format SQLite database Cloud-optimised archive (Hilbert-curve index)
File count 1 1
Needs a tile server Yes No (supports HTTP range requests)
Best for Local / on-prem serving Cloud storage (S3, Azure Blob, GCS)

Use MBTiles for local or on-prem serving (e.g. feeding CesiumForUnreal on the same machine or network). It's a SQLite file with fast tile lookups and no coordinate flipping at read time.

Use PMTiles if you plan to host tiles in cloud storage. PMTiles can be served directly from a bucket via HTTP range requests with no tile server needed. However, TMS clients like CesiumForUnreal cannot consume PMTiles directly — they still need a server translating to TMS endpoints.

Either format works identically when served through tilepack serve — clients see the same TMS and WMTS endpoints regardless of the backing archive.

License

MIT

Metadata

Release files for tilepack 0.2.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 tilepack 0.2.0
File Size Uploaded Provenance Actions
tilepack-0.2.0.tar.gz 83.6 kB With provenance Details for tilepack-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tilepack 0.2.0
File Interpreter ABI Platform Actions
tilepack-0.2.0-py3-none-any.whl Python 3 none any Details for tilepack-0.2.0-py3-none-any.whl

Total release size: 101.8 kB

Release files / tilepack-0.2.0.tar.gz

Download URL tilepack-0.2.0.tar.gz
Size 83.6 kB
Tags Source
SHA-256 checksum
How to use checksums
db30d257d9da593df2499a634dd7680a1ec4705b63cf3e944de8c159a523c208
BLAKE2b-256 checksum
How to use checksums
b08d86a4eac8e90278f4090507f71f875376085fe72c844a23c524753b04f6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 1, 2026.

Transparency log

Release files / tilepack-0.2.0-py3-none-any.whl

Download URL tilepack-0.2.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0b01c1a09ef84d1ef48f53eb0debaa131e8dd8b3ff0096bf352fafdc2e9323c
BLAKE2b-256 checksum
How to use checksums
292483daaa3ede47ef88adc5f83e3e3419b4ea3d1a8d579adebbb8fb07e9578c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 1, 2026.

Transparency log

Security for tilepack 0.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tilepack-0.2.0.tar.gz

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 Mar 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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