planetiler

Planetiler Architecture

Architecture Diagram

Planetiler builds a map in 3 phases:

  1. Process Input Files according to the Profile and write vector tile features to intermediate files on disk
  2. Sort Features by tile ID
  3. Emit Vector Tiles by iterating through sorted features to group by tile ID, encoding, and writing to the output MBTiles file

1) Process Input Files

First, Planetiler reads SourceFeatures from each input source:

Then, for each SourceFeature, generate vector tile features according to the Profile in a worker thread (default 1 per core):

Finally, a single-threaded writer reads encoded features off of the work queue and writes them to disk using ExternalMergeSort#add

2) Sort Features

ExternalMergeSort sorts all of the intermediate features using a worker thread per core:

3) Emit Vector Tiles

MbtilesWriter is the main driver. First, a single-threaded reader reads features from disk:

Then, process tile batches in worker threads (default 1 per core):

Finally, a single-threaded writer writes encoded vector tiles to the output MBTiles file: