Struct tilejson::TileJSON

source ·
pub struct TileJSON {
Show 18 fields pub tilejson: String, pub tiles: Vec<String>, pub vector_layers: Option<Vec<VectorLayer>>, pub attribution: Option<String>, pub bounds: Option<Bounds>, pub center: Option<Center>, pub data: Option<Vec<String>>, pub description: Option<String>, pub fillzoom: Option<u8>, pub grids: Option<Vec<String>>, pub legend: Option<String>, pub maxzoom: Option<u8>, pub minzoom: Option<u8>, pub name: Option<String>, pub scheme: Option<String>, pub template: Option<String>, pub version: Option<String>, pub other: BTreeMap<String, Value>,
}
Expand description

TileJSON struct represents tilejson-spec metadata as specified by https://github.com/mapbox/tilejson-spec (version 3.0.0) Some descriptions were copied verbatim from the spec per CC-BY 3.0 license.

Fields§

§tilejson: String

A semver.org style version number as a string. Describes the version of the TileJSON spec that is implemented by this JSON object. Example: "3.0.0" See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#31-tilejson

§tiles: Vec<String>

An array of tile endpoints.

{z}, {x} and {y}, if present, are replaced with the corresponding integers. If multiple endpoints are specified, clients may use any combination of endpoints. All endpoint urls MUST be absolute. All endpoints MUST return the same content for the same URL. The array MUST contain at least one endpoint. The tile extension is NOT limited to any particular format. Some of the more popular are: mvt, vector.pbf, png, webp, and jpg. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#32-tiles

§vector_layers: Option<Vec<VectorLayer>>

An array of objects. 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.

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

§attribution: Option<String>

Contains an attribution to be displayed when the map is shown to a user.

Implementations MAY decide to treat this as HTML or literal text. For security reasons, make absolutely sure that this content can’t be abused as a vector for XSS or beacon tracking. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#34-attribution

§bounds: Option<Bounds>

The maximum extent of available map tiles.

Bounds MUST define an area covered by all zoom levels. The bounds are represented in WGS 84 latitude and longitude values, in the order left, bottom, right, top. Values may be integers or floating point numbers. The minimum/maximum values for longitude and latitude are -180/180 and -90/90 respectively. Bounds MUST NOT “wrap” around the ante-meridian. If bounds are not present, the default value MAY assume the set of tiles is globally distributed.

Bounds where longitude values are the same, and latitude values are the same, are considered valid. This case typically represents a single point geometry in the entire tileset. For example: [-122.34, 47.65, -122.34, 47.65].

OPTIONAL. Array. Default: [ -180, -85.05112877980659, 180, 85.0511287798066 ] (xyz-compliant tile bounds)

See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#35-bounds

§center: Option<Center>

The first value is the longitude, the second is latitude (both in WGS:84 values),

the third value is the zoom level as an integer. Longitude and latitude MUST be within the specified bounds. The zoom level MUST be between minzoom and maxzoom. Implementations MAY use this center value to set the default location. If the value is null, implementations MAY use their own algorithm for determining a default location.
OPTIONAL. Array. Default: null. Example: "center": [ -76.275329586789, 39.153492567373, 8 ] See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#36-center

§data: Option<Vec<String>>

An array of data files in GeoJSON format.

{z}, {x} and {y}, if present, are replaced with the corresponding integers. If multiple endpoints are specified, clients may use any combination of endpoints. All endpoints MUST return the same content for the same URL. If the array doesn’t contain any entries, then no data is present in the map. This field is for overlaying GeoJSON data on tiled raster maps and is generally no longer used for GL-based maps. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#37-data

§description: Option<String>

A text description of the set of tiles.

The description can contain any valid unicode character as described by the JSON specification RFC 8259. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#38-description

§fillzoom: Option<u8>

An integer specifying the zoom level from which to generate overzoomed tiles.

Implementations MAY generate overzoomed tiles from parent tiles if the requested zoom level does not exist. In most cases, overzoomed tiles are generated from the maximum zoom level of the set of tiles. If fillzoom is specified, the overzoomed tile MAY be generated from the fillzoom level.

For example, in a set of tiles with maxzoom 10 and no fillzoom specified, a request for a z11 tile will use the z10 parent tiles to generate the new, overzoomed z11 tile. If the same TileJSON object had fillzoom specified at z7, a request for a z11 tile would use the z7 tile instead of z10.

While TileJSON may specify rules for overzooming tiles, it is ultimately up to the tile serving client or renderer to implement overzooming.

OPTIONAL. Integer. Default: null. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#39-fillzoom

§grids: Option<Vec<String>>

An array of interactivity endpoints.

{z}, {x} and {y}, if present, are replaced with the corresponding integers. If multiple endpoints are specified, clients may use any combination of endpoints. All endpoints MUST return the same content for the same URL. If the array doesn’t contain any entries, UTF-Grid interactivity is not supported for this set of tiles. See https://github.com/mapbox/utfgrid-spec/tree/master/1.2 for the interactivity specification.

Note: UTF-Grid interactivity predates GL-based map rendering and interaction. Map interactivity is now generally defined outside of the TileJSON specification and is dependent on the tile rendering library’s features.

See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#310-grids

§legend: Option<String>

Contains a legend to be displayed with the map.

Implementations MAY decide to treat this as HTML or literal text. For security reasons, make absolutely sure that this field can’t be abused as a vector for XSS or beacon tracking. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#311-legend

§maxzoom: Option<u8>

An integer specifying the maximum zoom level.

MUST be in range: 0 <= minzoom <= maxzoom <= 30. A client or server MAY request tiles outside of the zoom range, but the availability of these tiles is dependent on how the the tile server or renderer handles the request (such as overzooming tiles). OPTIONAL. Integer. Default: 30. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#312-maxzoom

§minzoom: Option<u8>

An integer specifying the minimum zoom level.

MUST be in range: 0 <= minzoom <= maxzoom <= 30. OPTIONAL. Integer. Default: 0. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#313-minzoom

§name: Option<String>

A name describing the tileset.

The name can contain any legal character. Implementations SHOULD NOT interpret the name as HTML. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#314-name

§scheme: Option<String>

Either “xyz” or “tms”.

Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. OPTIONAL. String. Default: “xyz”. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#315-scheme

§template: Option<String>

Contains a mustache template to be used to format data from grids for interaction.

See https://github.com/mapbox/utfgrid-spec/tree/master/1.2 for the interactivity specification. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#316-template

§version: Option<String>

A semver.org style version number of the tiles.

When changes across tiles are introduced the minor version MUST change. This may lead to cut off labels. Therefore, implementors can decide to clean their cache when the minor version changes. Changes to the patch level MUST only have changes to tiles that are contained within one tile. When tiles change significantly, such as updating a vector tile layer name, the major version MUST be increased. Implementations MUST NOT use tiles with different major versions. OPTIONAL. String. Default: “1.0.0”. See https://github.com/mapbox/tilejson-spec/tree/master/3.0.0#317-version

§other: BTreeMap<String, Value>

Any unrecognized fields will be stored here

Implementations§

source§

impl TileJSON

source

pub fn set_missing_defaults(&mut self)

Set any missing default values per tile-json specification

Trait Implementations§

source§

impl Clone for TileJSON

source§

fn clone(&self) -> TileJSON

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 TileJSON

source§

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

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

impl<'de> Deserialize<'de> for TileJSON

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 TileJSON

source§

fn eq(&self, other: &TileJSON) -> 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 TileJSON

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 StructuralPartialEq for TileJSON

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