Skip to content
/ mvt Public
forked from DougLau/mvt

Rust library for encoding mapbox vector tiles

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

mnit-rtmc/mvt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mvt

A library for encoding mapbox vector tiles (MVT). Version 2.1 of the standard is supported.

The API is designed to prevent creating files which are not allowed by the specification.

Example

use mvt::{Error, GeomEncoder, GeomType, Tile, Transform};

fn main() -> Result<(), Error> {
    let mut tile = Tile::new(4096);
    let layer = tile.create_layer("First Layer");
    let b = GeomEncoder::new(GeomType::Linestring, Transform::new())
                        .point(0.0, 0.0)
                        .point(1024.0, 0.0)
                        .point(1024.0, 2048.0)
                        .point(2048.0, 2048.0)
                        .point(2048.0, 4096.0)
                        .encode()?;
    let mut feature = layer.into_feature(b);
    feature.set_id(1);
    feature.add_tag_string("key", "value");
    let layer = feature.into_layer();
    tile.add_layer(layer)?;
    let data = tile.to_bytes()?;
    println!("encoded {} bytes: {:?}", data.len(), data);
    Ok(())
}

Alternatives

These are other rust projects with MVT support:

About

Rust library for encoding mapbox vector tiles

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%