Struct tilejson::VectorLayer

source ·
pub struct VectorLayer {
    pub id: String,
    pub fields: BTreeMap<String, String>,
    pub description: Option<String>,
    pub maxzoom: Option<u8>,
    pub minzoom: Option<u8>,
    pub other: BTreeMap<String, Value>,
}
Expand description

Each object describes one layer of vector tile data.

A vector_layer object MUST contain the id and fields keys, and MAY contain the description, minzoom, or maxzoom keys. An implementation MAY include arbitrary keys in the object outside of those defined in this specification.

Note: When describing a set of raster tiles or other tile format that does not have a “layers” concept (i.e. “format”: “jpeg”), the vector_layers key is not required.

These keys are used to describe the situation where different sets of vector layers appear in different zoom levels of the same set of tiles, for example in a case where a “minor roads” layer is only present at high zoom levels.

{
  "vector_layers": [
    {
      "id": "roads",
      "description": "Roads and their attributes",
      "minzoom": 2,
      "maxzoom": 16,
      "fields": {
        "type": "One of: trunk, primary, secondary",
        "lanes": "Number",
        "name": "String",
        "sidewalks": "Boolean"
      }
    },
    {
      "id": "countries",
      "description": "Admin 0 (country) boundaries",
      "minzoom": 0,
      "maxzoom": 16,
      "fields": {
        "iso": "ISO 3166-1 Alpha-2 code",
        "name": "English name of the country",
        "name_ar": "Arabic name of the country"
      }
    },
    {
      "id": "buildings",
      "description": "A layer with an empty fields object",
      "fields": {}
    }
  ]
}

See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#33-vector_layers

Fields§

§id: String

A string value representing the the layer id.

For added context, this is referred to as the name of the layer in the Mapbox Vector Tile spec. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#331-id

§fields: BTreeMap<String, String>

An object whose keys and values are the names and descriptions of attributes available in this layer.

Each value (description) MUST be a string that describes the underlying data. If no fields are present, the fields key MUST be an empty object. https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#332-fields

§description: Option<String>

A string representing a human-readable description of the entire layer’s contents.

See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#333-description

§maxzoom: Option<u8>

An integer representing the highest zoom level whose tiles this layer appears in.

maxzoom MUST be less than or equal to the set of tiles’ maxzoom. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#334-minzoom-and-maxzoom

§minzoom: Option<u8>

An integer representing the lowest zoom level whose tiles this layer appears in.

minzoom MUST be greater than or equal to the set of tiles’ minzoom. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#334-minzoom-and-maxzoom

§other: BTreeMap<String, Value>

Any unrecognized fields will be stored here.

Implementations§

source§

impl VectorLayer

source

pub fn new(id: String, fields: BTreeMap<String, String>) -> Self

Trait Implementations§

source§

impl Clone for VectorLayer

source§

fn clone(&self) -> VectorLayer

Returns a copy 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 VectorLayer

source§

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

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

impl<'de> Deserialize<'de> for VectorLayer

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for VectorLayer

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for VectorLayer

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for VectorLayer

source§

impl StructuralEq for VectorLayer

source§

impl StructuralPartialEq for VectorLayer

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,