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;
25mod disk;
26pub mod geometry;
27pub mod layers;
28pub mod raster;
29pub mod reconstruct;
30pub mod sort;
31pub mod splat;
32pub mod terrain;
33pub mod tile;
34pub mod timing;
35
36pub use geolith::error;
37pub use geolith::output;
38pub use geolith::{conflation, progress, source};
39
40pub use config::{Reuse, TilesConfig};
41
42mod mlt;
43mod pipeline;
44mod tiles_error;
45
46pub use tiles_error::TilesError;
47
48/// Build the vector tile archive `config` describes: read, sort, merge and
49/// write the protomaps-schema `PMTiles` file.
50///
51/// # Errors
52///
53/// Propagates any error from reading the sources, sorting, or writing the
54/// archive.
55pub fn run(config: &TilesConfig) -> Result<(), TilesError> {
56 pipeline::execute(config)
57}