Crate versatiles_container

Crate versatiles_container 

Source
Expand description

VersaTiles Container: read, convert, and write tile containers.

This crate exposes a small set of building blocks to work with map tile containers:

  • a registry that maps file extensions to readers/writers,
  • reader traits and adapters to stream tiles,
  • writer traits to serialize tiles,
  • utilities like caching and streaming combinators.

It is designed for runtime composition: readers are object‑safe and can be wrapped by adapters (e.g. bbox filters, axis flips, compression overrides) and then written out with the appropriate writer inferred from the output path.

§Quick start

use versatiles_container::*;
use versatiles_core::*;
use std::sync::Arc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Open a source container via the registry
    let runtime = TilesRuntime::default();
    let reader = runtime.get_reader_from_str("../testdata/berlin.mbtiles").await?;

    // Optionally adapt the reader: limit to a bbox pyramid, keep compression as-is
    let params = TilesConverterParameters {
        bbox_pyramid: Some(TileBBoxPyramid::new_full(8)),
        ..Default::default()
    };
    let reader = Arc::new(Box::new(TilesConvertReader::new_from_reader(reader, params)?) as Box<dyn TileSource>);

    // Write to a target path; format is inferred from the extension
    let output = std::env::temp_dir().join("example.versatiles");
    runtime.write_to_path(reader, &output).await?;
    Ok(())
}

§Features

  • cli: enables human‑readable probing of containers and tiles.
  • test: helpers for integration tests in downstream crates.

§See also

Re-exports§

pub use cache::*;
pub use progress::*;
pub use runtime::*;

Modules§

cache
Caching subsystem for VersaTiles.
progress
runtime
Re‑exports progress tracking and event bus types. Runtime configuration and services for tile processing operations

Structs§

ContainerRegistry
Registry mapping file extensions to async tile container readers and writers.
DataSource
Represents a parsed input specification which may include a driver prefix (like mbtiles:). It can resolve standard input (-) into an in-memory Blob and derives the effective extension that determines which reader to pick.
DirectoryReader
A reader for tiles stored in a directory structure.
DirectoryWriter
Writes a directory-based tile pyramid along with a compressed TileJSON (tiles.json[.<br|gz>]).
MBTilesReader
Reader for MBTiles (SQLite) containers.
MBTilesWriter
Writer for MBTiles (SQLite) containers.
PMTilesReader
Reader for PMTiles v3 containers.
PMTilesWriter
Writer for PMTiles v3 archives.
TarTilesReader
Reader for tiles stored inside a tar archive.
TarTilesWriter
Writer for tiles packaged inside a tar archive.
Tile
A lazy tile container that can hold either an encoded blob or decoded content.
TileProcessor
Base struct for tile processors that wrap a single upstream source.
TileSourceMetadata
Metadata describing the output characteristics of a tile source.
TilesConvertReader
Reader adapter that applies coordinate transforms, bbox filtering, and optional compression changes on-the-fly.
TilesConverterParameters
Parameters that control how tiles are transformed during reading/conversion.
Traversal
Represents a traversal strategy for iterating over tile bounding boxes.
TraversalSize
Represents allowed sizes of a block of tiles The size is represented as log2(size). For example, TraversalSize { max: 6 } represents block of sizes up to 64 tiles.
VersaTilesReader
Reader for .versatiles containers.
VersaTilesWriter
Writer for .versatiles containers.

Enums§

DataLocation
A flexible location of data used across I/O code.
SourceType
Distinguishes between different tile source types.
TileContent
Decoded tile content (raster or vector).
TraversalOrder
Strategies for ordering tiles when traversing a tile pyramid.
TraversalTranslationStep
Represents a single operation during traversal translation from one traversal configuration to another.

Traits§

TileSource
Unified object-safe interface for reading or processing tiles.
TileSourceTraverseExt
Extension trait providing traversal with higher-rank trait bounds (HRTBs).
TilesWriter
Object‑safe interface for writing tiles from a reader into a container format.

Functions§

convert_tiles_container
Converts tiles from the given reader and writes them to path using the provided runtime.
translate_traversals
Translates traversal steps from a reading traversal configuration to a writing traversal configuration.