Skip to main content

Crate elivagar

Crate elivagar 

Source
Expand description

Shortbread vector tile generator.

Elivagar reads OpenStreetMap PBF files and produces PMTiles v3 archives with the Shortbread schema (26 layers).

§Usage

The primary entry point is run(), which takes a TilegenConfig and drives the full pipeline:

let config = elivagar::TilegenConfig {
    pbf_path: "input.osm.pbf".into(),
    output_path: "output.pmtiles".into(),
    tmp_dir: "data/tilegen_tmp".into(),
    min_zoom: 0,
    max_zoom: 14,
    ocean_shapefile: None,
    ocean_simplified_shapefile: None,
    ocean_tiles: None,
    ocean_artifact_key: None,
    ocean_only_metadata: false,
    skip_to: None,
    in_memory: false,
    compression_level: 6,
    force_sorted: false,
    allow_unsafe_flat_index: false,
    threads: std::thread::available_parallelism().map(|n| n.get()).unwrap_or(4),
    way_inflight_budget: 0,
    assemble_batch_budget: 0,
    sort_chunk_size: 0,
    locations_on_ways: false,
    tile_format: elivagar::TilePayloadFormat::Mvt,
    tile_compression: elivagar::TileCompression::Gzip,
    compress_sort_chunks: elivagar::sort::ChunkCompression::None,
    seam_reconcile_layers: {
        let mut m = [0u8; elivagar::shortbread::Layer::count()];
        m[elivagar::shortbread::Layer::Boundaries as usize] = 8;
        m
    },
    fanout_caps: [0; elivagar::shortbread::Layer::count()],
    polygon_simplify_factor: 1.0,
};
elivagar::run(&config).expect("pipeline failed");

§Pipeline phases

  1. PBF read - single-pass read building node/way indices and emitting sort records for matched features.
  2. Ocean - ocean shapefile processing (optional). Generates water polygon tiles from an ESRI shapefile.
  3. Sort - external merge sort of all records by Hilbert tile ID.
  4. Assembly - MVT protobuf encode, gzip compress, and write PMTiles archive.

The SkipTo enum allows resuming from a checkpoint, reusing sort chunks from a previous run.

§PMTiles writer

The pmtiles_writer module is also public for standalone use. It writes clustered PMTiles v3 archives with Hilbert-ordered tile IDs and content deduplication.

Modules§

inspect
PMTiles v3 archive inspector.
node_index
pmtiles_reader
Minimal PMTiles v3 reader.
pmtiles_writer
PMTiles v3 archive writer.
provenance
Provenance recorded in PMTiles archive metadata under the elivagar key.
shortbread
sort
svg
Render a single MVT tile from a PMTiles archive as SVG.
tile_detail
MVT tile decoder producing structural detail for out-of-crate adjudication.
verify
PMTiles output verification.

Structs§

PipelineError
Pipeline error type. Stringly-typed because no caller inspects variants - errors are only displayed or propagated. An enum would add boilerplate for no benefit.
TilegenConfig
Configuration for the tile generation pipeline.

Enums§

OceanMode
Ocean producer selected for the checkpointed chunk set.
SkipTo
Which pipeline phase to skip to.
TileCompression
Tile compression algorithm for MVT payloads.
TilePayloadFormat
Tile payload encoding format stored in PMTiles tile data.

Functions§

ocean_build
Build the durable world-ocean artifact without opening an OSM PBF. It uses the normal ocean, external-sort, and partitioned assembly path so artifact bytes obey the same encoding and compression rules as runtime ocean tiles.
run
Errors