Skip to main content

VectorTileLayer

Struct VectorTileLayer 

Source
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: u32

Tile coordinate extent used to quantize geometry (default 4096).

§features: Vec<VectorTileFeature>

The layer’s vector‑tile features (geometry + tags).

§name: String

Human‑readable layer name (MVT field 1).

§property_manager: PropertyManager

Global key/value tables shared by all features in this layer.

§version: u32

MVT layer version (default 1).

Implementations§

Source§

impl VectorTileLayer

Source

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.

Source

pub fn new_standard(name: &str) -> VectorTileLayer

Convenience constructor using the common defaults extent = 4096, version = 1.

Source

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.

Source

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.

Source

pub fn to_features(&self) -> Result<Vec<GeoFeature>>

Converts all vector‑tile features into high‑level GeoFeatures using this layer’s property tables.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn retain_features<F>(&mut self, filter_fn: F)
where F: Fn(&VectorTileFeature) -> bool,

Retains only features that satisfy filter_fn (applies to raw VectorTileFeatures).

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> VectorTileLayer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VectorTileLayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VectorTileLayer

Source§

fn default() -> VectorTileLayer

Returns the “default value” for a type. Read more
Source§

impl PartialEq for VectorTileLayer

Source§

fn eq(&self, other: &VectorTileLayer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VectorTileLayer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool