Skip to main content

geolith_tiles_builder/
lib.rs

1#![warn(missing_docs)]
2
3//! geolith-tiles-builder: tiles from OSM and Overture Maps.
4//!
5//! One module per output type:
6//!
7//! - the vector tile build, [`run`], writes a protomaps-schema `PMTiles`
8//!   archive from Overture Parquet and OSM,
9//! - [`terrain`] writes Terrain-RGB `PMTiles` from `GeoTIFF` DEMs,
10//! - [`raster`] archives a raster tile service as `PMTiles`,
11//! - [`splat`] writes an OGC 3D Tiles tileset from a Gaussian splat,
12//! - [`reconstruct`] turns drone video into a splat.
13//!
14//! The vector build runs in four phases:
15//! 1. **Read + Process**: discover Parquet files, read features, route to
16//!    layer processors, project to world coordinates, clip to tiles, snap to
17//!    tile-local integers, encode MVT geometry commands.
18//! 2. **External Sort**: buffer `SortEntry` items, flush sorted chunks to
19//!    disk when the buffer exceeds a threshold.
20//! 3. **K-Way Merge**: merge all sorted chunks into globally sorted order.
21//! 4. **`PMTiles` Write**: group entries by tile, encode MVT tiles, gzip
22//!    compress, write the archive in Hilbert order.
23
24pub mod config;
25pub mod geometry;
26pub mod layers;
27pub mod raster;
28pub mod reconstruct;
29pub mod sort;
30pub mod splat;
31pub mod terrain;
32pub mod tile;
33pub mod timing;
34
35pub use geolith::error;
36pub use geolith::output;
37pub use geolith::{conflation, progress, source};
38
39pub use config::{Reuse, TilesConfig};
40
41mod mlt;
42mod pipeline;
43
44/// Build the vector tile archive `config` describes: read, sort, merge and
45/// write the protomaps-schema `PMTiles` file.
46///
47/// # Errors
48///
49/// Propagates any error from reading the sources, sorting, or writing the
50/// archive.
51pub fn run(config: &TilesConfig) -> anyhow::Result<()> {
52    pipeline::execute(config)
53}