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