Crate versatiles

source
Expand description

§VersaTiles

VersaTiles is a fast Rust library for reading, writing, and converting between different tile containers.

§Features

  • Read and Write: Supports reading and writing various tile container formats.
  • Convert: Convert between different tile formats and compressions.

§Supported Formats

  • *.versatiles
  • *.mbtiles (requires full feature)
  • *.pmtiles (requires full feature)
  • *.tar (requires full feature)
  • tiles stored in a local directory

§Usage Example

use versatiles::{
    container::{get_reader, write_to_filename},
    types::{TileFormat, TilesReaderTrait}
};
use std::path::Path;
use anyhow::Result;

#[tokio::main]
async fn main() -> Result<()> {
    // Define the input filename (local file or URL)
    let input_filename = "../testdata/berlin.pmtiles";
    let mut reader = get_reader(input_filename).await?;

    // Define the output filename
    let output_filename = "../testdata/temp1.versatiles";

    // Write the tiles to the output file
    write_to_filename(&mut *reader, output_filename).await?;

    println!("Tiles have been successfully converted and saved to {output_filename}");
    Ok(())
}

Re-exports§

Modules§

  • Contains types like coordinates, bounding boxes (bboxes), format types, and more.

Macros§