pub struct TileJson {
pub tilejson: String,
pub name: Option<String>,
pub description: Option<String>,
pub version: Option<String>,
pub attribution: Option<String>,
pub tiles: Vec<String>,
pub min_zoom: u8,
pub max_zoom: u8,
pub bounds: Option<[f64; 4]>,
pub center: Option<[f64; 3]>,
pub scheme: TileScheme,
pub vector_layers: Vec<VectorLayerMeta>,
}Expand description
Parsed TileJSON metadata.
This is a framework-agnostic representation of the subset of TileJSON fields that the engine needs to configure tile managers and sources.
Fields§
§tilejson: StringTileJSON spec version (e.g. "3.0.0").
name: Option<String>Optional human-readable name.
description: Option<String>Optional description.
version: Option<String>TileJSON version string (semver).
attribution: Option<String>Optional attribution HTML string.
tiles: Vec<String>Tile URL templates with {z}, {x}, {y} placeholders.
min_zoom: u8Minimum zoom level supported by the source.
max_zoom: u8Maximum zoom level supported by the source.
bounds: Option<[f64; 4]>Geographic bounds as [west, south, east, north] in WGS-84 degrees.
None means the source covers the whole world.
center: Option<[f64; 3]>Default center + zoom as [lon, lat, zoom].
scheme: TileSchemeTile encoding scheme.
vector_layers: Vec<VectorLayerMeta>Vector layer metadata (only present for vector tile sources).
Implementations§
Source§impl TileJson
impl TileJson
Sourcepub fn with_tiles(tiles: Vec<String>) -> Self
pub fn with_tiles(tiles: Vec<String>) -> Self
Create a minimal TileJSON with a single tile URL template.
Sourcepub fn first_tile_url(&self) -> Option<&str>
pub fn first_tile_url(&self) -> Option<&str>
Return the first tile URL template, if any.
Sourcepub fn is_vector(&self) -> bool
pub fn is_vector(&self) -> bool
Return true if this TileJSON describes a vector tile source
(has vector_layers).
Sourcepub fn source_layer_names(&self) -> Vec<&str>
pub fn source_layer_names(&self) -> Vec<&str>
Return the names of all declared vector source layers.
Sourcepub fn contains_point(&self, lon: f64, lat: f64) -> bool
pub fn contains_point(&self, lon: f64, lat: f64) -> bool
Check whether a geographic coordinate is within the source bounds.
Returns true when no bounds are set (unbounded source).