Expand description
§S2 Tile JSON 🌎 🗺️
.d8888. .d888b.
88' YP VP `8D
`8bo. odD'
`Y8b. .88'
db 8D j88.
`8888Y' 888888D
d888888b d888888b db d88888b
`~~88~~' `88' 88 88'
88 88 88 88ooooo
88 88 88 88~~~~~
88 .88. 88booo. 88.
YP Y888888P Y88888P Y88888P
d88b .d8888. .d88b. d8b db
`8P' 88' YP .8P Y8. 888o 88
88 `8bo. 88 88 88V8o 88
88 `Y8b. 88 88 88 V8o88
db. 88 db 8D `8b d8' 88 V888
Y8888P `8888Y' `Y88P' VP V8P §Install
cargo add s2-tilejson§About
TileJSON is a backwards-compatible open standard for representing map tile metadata.
This specification attempts to create a standard for representing metadata about multiple types of web-based map layers, to aid clients in configuration and browsing.
§Usage
The Documentation is very thorough in this library. Therefore the best thing to do is follow the links provided as needed.
§Tools
crate::MetadataBuilder: Build a Metadata from scratch. Helper tool when constructing a set of tiles
§Top Level Types
crate::Metadata: Represents a TileJSON metadata object for the new S2 spec.crate::MapboxTileJSONMetadata: Represents a TileJSON metadata object for the old Mapbox spec.crate::UnknownMetadata: If we don’t know which spec we are reading, we can treat the input as either.
§Sub Types
crate::LonLatBounds: Use bounds as floating point numbers for longitude and latitudecrate::TileBounds: Use bounds as u64 for the tile index rangecrate::DrawType: Description of what kind of data is in the tilecrate::LayerMetaData: Each layer has metadata associated with it. Defined as blueprints pre-construction of vector data.crate::TileStatsMetadata: Tilestats is simply a tracker to see where most of the tiles livecrate::Attributions: Attribution data is stored in an object. The key is the name of the attribution, and the value is the linkcrate::FaceBounds: Track the S2 tile bounds of each face and zoomcrate::WMBounds: Track the WM tile bounds of each zoom[zoom: number]: BBoxcrate::SourceType: Check the source type of the layercrate::Encoding: Store the encoding of the datacrate::VectorLayer: Old spec tracks basic vector datacrate::Scheme: Default S2 tile scheme is fzxy Default Web Mercator tile scheme is xyz Adding a t prefix to the scheme will change the request to be time sensitive TMS is an oudated version that is not supported by s2maps-gpucrate::Center: Store where the center of the data lives
Modules§
- geometry
- All geometry types and structs
- impls
- All json, value, shape impl
- map
- BTreeMap wrapper
- shape
- All shape types and structs
- value
- All values types and structs
Structs§
- BBox
- Bounding Box
- BBox3D
- 3D Bounding Box
- Base
Geometry - BaseGeometry is the a generic geometry type
- Center
- Store where the center of the data lives
- Face
Bounds - Track the S2 tile bounds of each face and zoom
- Feature
- Component to build an WG Feature
- Feature
Collection - WG FeatureCollection
- Layer
Meta Data - Each layer has metadata associated with it. Defined as blueprints pre-construction of vector data.
- Map
- A BTreeMap wrapper
- Mapbox
TileJSON Metadata - TileJSON V3.0.0
- Metadata
- S2 TileJSON V1.0.0
- Metadata
Builder - Metadata Builder
- Point
- Definition of a Point. May represent WebMercator Lon-Lat or S2Geometry S-T
- Point3D
- Definition of a 3D Point. May represent WebMercator Lon-Lat or S2Geometry S-T with a z-value
- Point
OrPoint3D - Define a Point or Point3D
- S2Feature
Collection - S2 FeatureCollection
- STPoint
- A Point in S2 Space with a Face
- Tile
Stats Metadata - Tilestats is simply a tracker to see where most of the tiles live
- Vector
Base Geometry - BaseGeometry is the a generic geometry type
- Vector
Feature - Component to build an WG or S2 Vector Feature
- Vector
Layer - Old spec tracks basic vector data
- Vector
Point - Vector Points
Enums§
- Axis
- The axis to apply an operation to
- BBOX
- BBox or BBox3D
- Draw
Type - 1: points, 2: lines, 3: polys, 4: points3D, 5: lines3D, 6: polys3D
- Encoding
- Store the encoding of the data
- Face
- Cube-face on the S2 sphere
- Feature
Collection Type - FeatureCollection type string
- Feature
Collections - Either an S2 or WG FeatureCollection
- Feature
Type - Feature type string
- Features
- Either an S2, Vector WG or WG Feature
- Geometry
- All possible geometry shapes
- Geometry
Type - Enum to represent specific geometry types as strings
- JSON
Collection - All major GeoJSON and S2JSON types
- JSON
Value - All possible JSON shapes
- MValues
- All possible M-Value shapes
- Primitive
Shape - Primitive types that can be found in a shape
- Primitive
Shape Type - Arrays may contain either a primitive or an object whose values are primitives
- Primitive
Value - Primitive types supported by Properties
- Projection
- All projections that can be used
- S2Feature
Collection Type - FeatureCollection type string
- Scheme
- Default S2 tile scheme is
fzxyDefault Web Mercator tile scheme isxyzAdding a t prefix to the scheme will change the request to be time sensitive TMS is an oudated version that is not supported by s2maps-gpu - Shape
Type - Shape types that can be found in a shapes object. Either a primitive, an array containing any type, or a nested shape. If the type is an array, all elements must be the same type
- Source
Type - Check the source type of the layer
- Unknown
Metadata - If we don’t know which spec we are reading, we can treat the input as either
- Value
Primitive Type - Arrays may contain either a primitive or an object whose values are primitives
- Value
Type - Supports primitive types
string,number,boolean,nullMay be an array of those primitive types, or an object whose values are only primitives Object keys are always strings, values can be any basic type, an array, or a nested object. Array values must all be the same type. - Vector
Feature Type - Feature type string
- Vector
Geometry - Vector Geometry
- Vector
Geometry Type - Enum to represent specific vector geometry types as strings
- Vector
Offsets - All possible geometry offsets
Traits§
- Bounded
- Trait for types that have a min and max value. Used by
BBoxandBBox3D - FullXY
- Composite Trait for XY use cases
- FullXYM
- Composite Trait for XYM use cases
- FullXYZ
- Composite Trait for XYZ use cases
- FullXYZM
- Composite Trait for XYZM use cases
- GetM
- Trait to extract the m value
- GetXY
- Trait to extract the x and y values
- GetXYM
- Composite Trait: XY + M
- GetXYZ
- Composite Trait: XY + Z
- GetXYZM
- Composite Trait: XY + Z + M
- GetZ
- Trait to extract the z value
- Interpolate
- Easy access to interpolation tooling for All S2JSON Core Types
- JSON
Properties Compatible - Ensure M implements MValueCompatible
- MValue
Compatible - Ensure M implements MValueCompatible
- NewXY
- Trait to create a new XY
- NewXYM
- Trait to create a new XY
- NewXYZ
- Trait to create a new XYZ
- NewXYZM
- Trait to create a new XYZM
- SetM
- Trait to set the m value
- SetXY
- Trait to set the x and y values
- SetXYM
- Composite Trait: XY + M
- SetXYZ
- Composite Trait: XY + Z
- SetXYZM
- Composite Trait: XY + Z + M
- SetZ
- Trait to set the z value
Type Aliases§
- Attributions
- Attribution data is stored in an object. The key is the name of the attribution, and the value is the link
- JSON
Properties - Shape of an un-restricted features properties object
- Layers
Meta Data - Each layer has metadata associated with it. Defined as blueprints pre-construction of vector data.
- Line
String - Definition of a LineString
- Line
String3D - Definition of a 3D LineString
- Line
String3D Geometry - LineString3DGeometry is a 3D line
- Line
String Geometry - LineStringGeometry is a line
- Line
StringM Values - LineString Properties Shape
- LonLat
Bounds - Use bounds as floating point numbers for longitude and latitude
- MValue
- Shape of a feature’s M-Values object
- Mapbox
Properties - Shape of the restricted Mapbox properties object
- Multi
Line String - Definition of a MultiLineString
- Multi
Line String3D - Definition of a 3D MultiLineString
- Multi
Line String3D Geometry - MultiLineString3DGeometry contains multiple 3D lines
- Multi
Line String Geometry - MultiLineStringGeometry contains multiple lines
- Multi
Line StringM Values - MultiLineString MValues Shape
- Multi
Point - Definition of a MultiPoint
- Multi
Point3D - Definition of a 3D MultiPoint
- Multi
Point3D Geometry - MultiPoint3DGeometry contains multiple 3D points
- Multi
Point Geometry - MultiPointGeometry contains multiple points
- Multi
Polygon - Definition of a MultiPolygon
- Multi
Polygon3D - Definition of a 3D MultiPolygon
- Multi
Polygon3D Geometry - MultiPolygon3DGeometry is a 3D polygon with multiple polygons with their own potential holes
- Multi
Polygon Geometry - MultiPolygonGeometry is a polygon with multiple polygons with their own potential holes
- Multi
PolygonM Values - MultiPolygon MValues Shape
- Point3D
Geometry - Point3DGeometry is a 3D point
- Point
Geometry - PointGeometry is a point
- Polygon
- Definition of a Polygon
- Polygon3D
- Definition of a 3D Polygon
- Polygon3D
Geometry - Polygon3DGeometry is a 3D polygon with potential holes
- Polygon
Geometry - PolygonGeometry is a polygon with potential holes
- PolygonM
Values - Polygon MValues Shape
- Properties
- Shape of a features properties object
- Shape
- The Shape Object
- Shape
Primitive - The Primitive Shape Object
- Tile
Bounds - Use bounds as u64 for the tile index range
- Value
- Shape design
- Value
Primitive - Shape of a ValuePrimitiveType Nested object
- Vector
Line Offset - An offset defines how far the starting line is from the original starting point pre-slice
- Vector
Line String - Definition of a Vector LineString
- Vector
Line String Geometry - LineStringGeometry is a line
- Vector
Multi Line Offset - A collection of offsets
- Vector
Multi Line String - Definition of a Vector MultiLineString
- Vector
Multi Line String Geometry - MultiLineStringGeometry contains multiple lines
- Vector
Multi Point - Definition of a Vector MultiPoint
- Vector
Multi Point Geometry - MultiPointGeometry contains multiple points
- Vector
Multi Polygon - Definition of a Vector MultiPolygon
- Vector
Multi Polygon Geometry - MultiPolygonGeometry is a polygon with multiple polygons with their own potential holes
- Vector
Multi Polygon Offset - A collection of collections of offsets
- Vector
Point Geometry - PointGeometry is a point
- Vector
Polygon - Definition of a Vector Polygon
- Vector
Polygon Geometry - PolygonGeometry is a polygon with potential holes
- Vector
Polygon Offset - A collection of offsets
- WMBounds
- Track the WM tile bounds of each zoom
[zoom: number]: BBox
Derive Macros§
- JSON
Properties - Derives the
JSONPropertiestrait for a struct to convert it to aJSONProperties. - MValue
- Derives the
MValuetrait for a struct to convert it to aMValue. - MValue
Compatible - Derives the
MValueCompatibletrait for a struct to convert it to aMValue. - Properties
- Derives the
Propertiestrait for a struct to convert it to aProperties. - Value
Primitive - Derives the
ValuePrimitivetrait for a struct to convert it to aValuePrimitive.