pmtiles-pipeline
Installation
SKILL.md
PMTiles Pipeline
Reference for building a single global PMTiles archive on one fat node, distilled from a real global change-layer build (~6T-px raster input, 176M polygons, 28 GB PMTiles output). The pipeline is:
raster.zarr → geoparquet shards → FlatGeobuf batches → sharded tippecanoe → tile-join → pmtiles
(1) (2) (3) (4) (5)
Each stage's "why" matters more than the syntax. Use this skill whenever a step in this pipeline is being built, debugged, or optimized.
Stage 1 — Raster → polygons (as parquet shards)
- Use
contourrs.shapes_arrowto vectorize a classified uint8 raster directly to Arrow (skip GeoJSON in/out). - Pre-filter with
scipy.ndimage.binary_opening(struct=NxN)per class to wipe salt-and-pepper noise. N=3 is a sane default at 10m resolution. - Write GeoParquet via geopandas with
compression="zstd". One parquet per super-tile (e.g., 8192² px) → tens of thousands of small shards. That granularity matters for downstream resume + parallelism. - Track fields:
class(uint8),area_deg2(float64 — useful for downstream filtering),geometry. - Connectivity 8 (diagonals count) and
min-pixels=25are fine starting defaults; higher min-pixels = aggressive smoothing.