Why PMTiles?
PMTiles is a single-file tileset you can version (like tiles_v12.pmtiles) and deploy as one artifact. Tiles are served over the network using HTTP Range Requests, making it suited for static hosting and CDN. It is a read-only format for stable delivery — rebuild to publish updates, with no in-place edits.
The 7-Step Methodology
Step 1 — Define a Tileset Contract
Freeze these items and treat them as an API. Changing them later means breaking clients silently.
- Layer names: roads, buildings, water, admin, pois
- Required fields per layer: class, name, rank, minzoom
- Field types: keep consistent across releases
Step 2 — Normalize Geometry Before Tiling
- Fix invalid geometries
- Snap and merge where needed (roads, boundaries)
- Standardize CRS for the build pipeline
Step 3 — Generalize by Zoom With Explicit Rules
- Polygon drop rules (area thresholds per zoom)
- Line simplify rules (tolerance per zoom)
- Preserve topology where it matters (networks, admin boundaries)
Step 4 — Encode Label Behavior in Attributes
Put label intent in data, not style overrides. This makes the tileset portable across different renderers and style sheets.
- rank — collision priority
- minzoom — visibility start
- Optional: ref, shield, place_level, is_capital
Step 5 — Build MVT and Package as PMTiles
Output one file as the release artifact. Example build commands:
ogr2ogr -f FlatGeobuf out.fgb input.shp
# Build vector tiles and write PMTiles
tippecanoe -o tileset.pmtiles -zg --drop-densest-as-needed out.fgb
Step 6 — QA Gates Before Publish
Automate checks and fail the build if any gate fails. These gates should live in CI so they run on every publish attempt.
- Layer list matches the contract
- Bounds and min/max zoom are sane
- Tile size distribution (find heavy tiles)
- Feature counts per zoom (detect drop cliffs)
- Label smoke test (cities, highways, POIs)
Step 7 — Host as a Static File
- Upload tileset.pmtiles to object storage
- Put a CDN in front
- Ensure range requests work
- Set cache headers and CORS for browser clients
Architecture
Raw data → object storage → tile build pipeline → versioned .pmtiles artifact → CDN delivery → web and native clients
When PMTiles Fits vs. When It Doesn’t
Use PMTiles for
- Basemaps and reference layers
- Thematic overlays released in versions
- Offline-ready field packages
- Cost-controlled CDN delivery
Use a dynamic tile service when you need
- Per-user auth at tile request time
- Parameterized filtering
- Frequent partial updates without full rebuilds
Tool Stack (Open-Source)
- Tippecanoe — Build MVT, output PMTiles
- GDAL / ogr2ogr — Convert and prepare inputs
- MapLibre GL JS + PMTiles protocol integration — Browser rendering
Checklist: Do This Today
- Write the layer and field contract and keep it in the repo
- Add rank and minzoom to all label layers
- Add a tile QA script to CI before every publish