geolith-tiles-builder 0.4.2

Builds tiles from OpenStreetMap and Overture Maps: protomaps-schema vector PMTiles, Terrain-RGB, raster archives and 3D Tiles from Gaussian splats
Documentation
//! Raster basemap archiver: XYZ/WMTS tile endpoints → `PMTiles`.
//!
//! Downloads a tile pyramid from any `{z}`/`{x}`/`{y}` HTTP endpoint with
//! polite rate limiting and a resumable on-disk cache, then packs the
//! tiles into a `PMTiles` v3 archive with content deduplication. Supports
//! hybrid pyramids (planet low zooms + one deep-zoom region) for
//! basemap-drape demos.

pub mod archive;
pub mod cache;
pub mod fetch;
pub mod pyramid;
pub mod template;

pub use archive::{RasterBuildOptions, RasterBuildStats, build_raster_archive};
pub use fetch::HttpFetcher;
pub use pyramid::PyramidSpec;
pub use template::UrlTemplate;

/// Build a raster basemap archive from the tiles `options` describe and write
/// it to `output`.
///
/// # Errors
///
/// Propagates download failures that survive retry and archive write errors.
pub fn run(
    options: &RasterBuildOptions,
    output: &std::path::Path,
) -> Result<(), crate::TilesError> {
    let total = options.pyramid.count();
    tracing::info!(
        tiles = total,
        min_zoom = options.pyramid.min_zoom,
        max_zoom = options.pyramid.max_zoom,
        concurrency = options.concurrency,
        cache = %options.cache_dir.display(),
        "raster archive build starting"
    );

    let fetcher = HttpFetcher::new();
    let stats = build_raster_archive(&fetcher, options, output)?;
    tracing::info!(
        output = %output.display(),
        downloaded = stats.downloaded,
        cached = stats.cached,
        missing = stats.missing,
        tiles = stats.tiles_written,
        unique = stats.unique_tiles,
        "raster archive written"
    );
    Ok(())
}