pub struct VectorTileLayer {
pub extent: u32,
pub features: Vec<VectorTileFeature>,
pub name: String,
pub property_manager: PropertyManager,
pub version: u32,
}Expand description
A single vector‑tile layer with features, key/value property tables, extent, and version.
The layer stores features in compact vector‑tile form. The property_manager maintains
the global key and value tables required by the MVT spec; features reference properties
by index via tag_ids. Helper methods convert to and from high‑level GeoFeature
values for easier processing and GeoJSON export.
Fields§
§extent: u32Tile coordinate extent used to quantize geometry (default 4096).
features: Vec<VectorTileFeature>The layer’s vector‑tile features (geometry + tags).
name: StringHuman‑readable layer name (MVT field 1).
property_manager: PropertyManagerGlobal key/value tables shared by all features in this layer.
version: u32MVT layer version (default 1).
Implementations§
Source§impl VectorTileLayer
impl VectorTileLayer
Sourcepub fn new(name: String, extent: u32, version: u32) -> VectorTileLayer
pub fn new(name: String, extent: u32, version: u32) -> VectorTileLayer
Creates a new layer with the given name, extent, and version.
Does not add any features; initializes an empty property table.
Sourcepub fn new_standard(name: &str) -> VectorTileLayer
pub fn new_standard(name: &str) -> VectorTileLayer
Convenience constructor using the common defaults extent = 4096, version = 1.
Sourcepub fn read(reader: &mut dyn ValueReader<'_, LE>) -> Result<VectorTileLayer>
pub fn read(reader: &mut dyn ValueReader<'_, LE>) -> Result<VectorTileLayer>
Reads a VectorTileLayer from a protobuf stream using the MVT wire format.
Expects the fields as defined by the MVT spec and collects keys/values into
the property_manager. Returns an error on malformed inputs.
Sourcepub fn to_blob(&self) -> Result<Blob>
pub fn to_blob(&self) -> Result<Blob>
Serializes the layer into a protobuf Blob (MVT wire format).
Writes name, features, key/value tables, and non‑default extent/version.
Sourcepub fn to_features(&self) -> Result<Vec<GeoFeature>>
pub fn to_features(&self) -> Result<Vec<GeoFeature>>
Converts all vector‑tile features into high‑level GeoFeatures using this layer’s property tables.
Sourcepub fn filter_map_properties<F>(&mut self, filter_fn: F) -> Result<()>
pub fn filter_map_properties<F>(&mut self, filter_fn: F) -> Result<()>
Filters/mutates features by decoding their properties, applying a filter that may drop the feature, recomputing the global property tables, and re‑encoding tag ids. Returns an error if decoding fails.
Sourcepub fn map_properties<F>(&mut self, filter_fn: F) -> Result<()>
pub fn map_properties<F>(&mut self, filter_fn: F) -> Result<()>
Transforms properties of all features (non‑dropping). Decodes properties, maps them, rebuilds the property tables, and re‑encodes tag ids.
Sourcepub fn add_vector_tile_features(
&mut self,
feature: VectorTileFeature,
properties: GeoProperties,
)
pub fn add_vector_tile_features( &mut self, feature: VectorTileFeature, properties: GeoProperties, )
Adds a VectorTileFeature with explicit properties by encoding its tag ids against the current property tables.
Sourcepub fn add_from_layer(&mut self, layer: VectorTileLayer) -> Result<()>
pub fn add_from_layer(&mut self, layer: VectorTileLayer) -> Result<()>
Merges another layer’s features into self, decoding their properties with the source layer’s tables
and re‑encoding them against this layer’s property_manager.
Sourcepub fn retain_features<F>(&mut self, filter_fn: F)
pub fn retain_features<F>(&mut self, filter_fn: F)
Retains only features that satisfy filter_fn (applies to raw VectorTileFeatures).
Sourcepub fn encode_tag_ids(&mut self, properties: GeoProperties) -> Vec<u32>
pub fn encode_tag_ids(&mut self, properties: GeoProperties) -> Vec<u32>
Encodes a property map to vector‑tile tag_ids using/expanding this layer’s property tables.
Sourcepub fn decode_tag_ids(&self, tag_ids: &[u32]) -> Result<GeoProperties>
pub fn decode_tag_ids(&self, tag_ids: &[u32]) -> Result<GeoProperties>
Decodes vector‑tile tag_ids back into a property map using this layer’s property tables.
Sourcepub fn from_features(
name: String,
features: Vec<GeoFeature>,
extent: u32,
version: u32,
) -> Result<VectorTileLayer>
pub fn from_features( name: String, features: Vec<GeoFeature>, extent: u32, version: u32, ) -> Result<VectorTileLayer>
Builds a layer from high‑level GeoFeatures.
Aggregates all properties into key/value tables and converts geometries into VectorTileFeatures
with encoded tag_ids.
Trait Implementations§
Source§impl Clone for VectorTileLayer
impl Clone for VectorTileLayer
Source§fn clone(&self) -> VectorTileLayer
fn clone(&self) -> VectorTileLayer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VectorTileLayer
impl Debug for VectorTileLayer
Source§impl Default for VectorTileLayer
impl Default for VectorTileLayer
Source§fn default() -> VectorTileLayer
fn default() -> VectorTileLayer
Source§impl PartialEq for VectorTileLayer
impl PartialEq for VectorTileLayer
impl StructuralPartialEq for VectorTileLayer
Auto Trait Implementations§
impl Freeze for VectorTileLayer
impl RefUnwindSafe for VectorTileLayer
impl Send for VectorTileLayer
impl Sync for VectorTileLayer
impl Unpin for VectorTileLayer
impl UnsafeUnpin for VectorTileLayer
impl UnwindSafe for VectorTileLayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more