pub struct VectorTile {
pub layers: BTreeMap<String, VectorLayer>,
pub grids: BTreeMap<String, GridData>,
pub images: BTreeMap<String, ImageData>,
/* private fields */
}
Expand description
§Open Vector Tile
§Description
A Vector Tile may parse either Mapbox or OpenVector Tile Layers The input is an unsigned byte array that has encoded protobuffer messages.
Types of layers include:
- Vector data - vector points, lines, and polygons with 3D coordinates, properties, and/or m-values
- Image data - raster data that is RGB(A) encoded
- Grid data: data that has a max-min range, works much like an image but has floating/double precision point values for each point on the grid
§Usage
ⓘ
use ovtile::{VectorTile, VectorLayerMethods};
let data: Vec<u8> = vec![];
let mut tile = VectorTile::new(data, None);
// VECTOR API
let landuse = tile.layer("landuse").unwrap();
// grab the first feature
let firstFeature = landuse.feature(0).unwrap();
// grab the geometry
let geometry = firstFeature.load_geometry();
// OR specifically ask for a geometry type
let points = firstFeature.load_points();
let lines = firstFeature.load_lines();
// If you want to take advantage of the pre-tessellated and indexed geometries
// and you're loading the data for a renderer, you can grab the pre-tessellated geometry
let (geometry_flat, indices) = firstFeature.load_geometry_flat();
// IMAGE API
let satellite = tile.images.get("satellite").unwrap();
// grab the image data
let data = &satellite.image;
// GRID API
let elevation = tile.grids.get("elevation").unwrap();
// grab the grid data
let data = &elevation.data;
Fields§
§layers: BTreeMap<String, VectorLayer>
the layers in the vector tile
grids: BTreeMap<String, GridData>
Gridded data
images: BTreeMap<String, ImageData>
Image data
Implementations§
Trait Implementations§
Source§impl Debug for VectorTile
impl Debug for VectorTile
Source§impl From<&mut VectorTile> for BaseVectorTile
impl From<&mut VectorTile> for BaseVectorTile
Source§fn from(vector_tile: &mut VectorTile) -> Self
fn from(vector_tile: &mut VectorTile) -> Self
Convert from Mapbox vector tile
Source§impl ProtoRead for VectorTile
impl ProtoRead for VectorTile
Auto Trait Implementations§
impl Freeze for VectorTile
impl !RefUnwindSafe for VectorTile
impl !Send for VectorTile
impl !Sync for VectorTile
impl Unpin for VectorTile
impl !UnwindSafe for VectorTile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more