diff --git a/README.md b/README.md index 166428b..5d1869e 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,12 @@ originally created by Brandon Liu for Protomaps. - Async `mmap` (Tokio) for local files - Async `http` and `https` (Reqwuest + Tokio) for URLs - Async `s3` (Rust-S3 + Tokio) for S3-compatible buckets +- Creating PMTile archives ## Plans & TODOs - [ ] Documentation and example code -- [ ] Support writing and conversion to and from MBTiles + `x/y/z` +- [ ] Support conversion to and from MBTiles + `x/y/z` - [ ] Support additional backends (sync `mmap` and `http` at least) - [ ] Support additional async styles (e.g., `async-std`) diff --git a/src/lib.rs b/src/lib.rs index a0395af..f36a2a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,19 @@ +//! Read and write `PMTiles` according to the [PMTiles v3 spec](https://github.com/protomaps/PMTiles/blob/master/spec/v3/spec.md). +//! +//! ## Writing a `PMTiles` file +//! +//! ```rust +//! use pmtiles::{PmTilesWriter, TileType}; +//! use std::fs::File; +//! +//! # let tile_0_0_0 = vec![]; +//! let file = File::create("tiles.pmtiles").unwrap(); +//! let mut writer = PmTilesWriter::new(TileType::Mvt).create(file).unwrap(); +//! writer.add_tile(0, &tile_0_0_0).unwrap(); +//! writer.finish().unwrap(); +//! ``` +//! + #![forbid(unsafe_code)] #[cfg(feature = "__async")]