Skip to content

Commit 1c5bd09

Browse files
committed
Add usage example
1 parent fa3a8fe commit 1c5bd09

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ originally created by Brandon Liu for Protomaps.
1717
- Async `mmap` (Tokio) for local files
1818
- Async `http` and `https` (Reqwuest + Tokio) for URLs
1919
- Async `s3` (Rust-S3 + Tokio) for S3-compatible buckets
20+
- Creating PMTile archives
2021

2122
## Plans & TODOs
2223

2324
- [ ] Documentation and example code
24-
- [ ] Support writing and conversion to and from MBTiles + `x/y/z`
25+
- [ ] Support conversion to and from MBTiles + `x/y/z`
2526
- [ ] Support additional backends (sync `mmap` and `http` at least)
2627
- [ ] Support additional async styles (e.g., `async-std`)
2728

src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
//! Read and write `PMTiles` according to the [PMTiles v3 spec](https://github.com/protomaps/PMTiles/blob/master/spec/v3/spec.md).
2+
//!
3+
//! ## Writing a `PMTiles` file
4+
//!
5+
//! ```rust
6+
//! use pmtiles::{PmTilesWriter, TileType};
7+
//! use std::fs::File;
8+
//!
9+
//! # let tile_0_0_0 = vec![];
10+
//! let file = File::create("tiles.pmtiles").unwrap();
11+
//! let mut writer = PmTilesWriter::new(TileType::Mvt).create(file).unwrap();
12+
//! writer.add_tile(0, &tile_0_0_0).unwrap();
13+
//! writer.finish().unwrap();
14+
//! ```
15+
//!
16+
117
#![forbid(unsafe_code)]
218

319
#[cfg(feature = "__async")]

0 commit comments

Comments
 (0)