Expand description
The s2json Rust crate provides functionalities to read and write S2JSON Spec data structures.
This crate is a 0 dependency package that uses no_std and is intended to be used in
embedded systems and WASM applications.
NOTE: WG stands for WGS84 and S2 stands for S2Geometry
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
- A BBOX is defined in lon-lat space and helps with zooming motion to see the entire line or polygon The order is (left, bottom, right, top) If WM, then the projection is lon-lat If S2, then the projection is s-t
- BBox3D
- A BBOX is defined in lon-lat space and helps with zooming motion to see the entire 3D line or polygon
- BaseGeometry 
- BaseGeometry is the a generic geometry type
- Feature
- Component to build an WG Feature
- FeatureCollection 
- WG FeatureCollection
- Map
- A BTreeMap wrapper
- 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
- PointOrPoint3D 
- Define a Point or Point3D
- S2FeatureCollection 
- S2 FeatureCollection
- STPoint
- A Point in S2 Space with a Face
- VectorBase Geometry 
- BaseGeometry is the a generic geometry type
- VectorFeature 
- Component to build an WG or S2 Vector Feature
- VectorPoint 
- A Vector Point uses a structure for 2D or 3D points
Enums§
- Axis
- The axis to apply an operation to
- BBOX
- BBox or BBox3D
- Face
- Cube-face on the S2 sphere
- FeatureCollection Type 
- FeatureCollection type string
- FeatureCollections 
- Either an S2 or WG FeatureCollection
- FeatureType 
- Feature type string
- Features
- Either an S2, Vector WG or WG Feature
- Geometry
- All possible geometry shapes
- GeometryType 
- Enum to represent specific geometry types as strings
- JSONCollection 
- All major S2JSON types
- JSONValue 
- All possible JSON shapes
- MValues
- All possible M-Value shapes
- PrimitiveShape 
- Primitive types that can be found in a shape
- PrimitiveShape Type 
- Arrays may contain either a primitive or an object whose values are primitives
- PrimitiveValue 
- Primitive types supported by Properties
- Projection
- All projections that can be used
- S2FeatureCollection Type 
- FeatureCollection type string
- ShapeType 
- 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
- ValuePrimitive Type 
- Arrays may contain either a primitive or an object whose values are primitives
- ValueType 
- 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.
- VectorFeature Type 
- Feature type string
- VectorGeometry 
- All possible geometry shapes
- VectorGeometry Type 
- Enum to represent specific vector geometry types as strings
- VectorOffsets 
- All possible geometry offsets
Traits§
- FullXY
- Composite Trait for XY 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
- JSONProperties Compatible 
- Ensure M implements MValueCompatible
- MValueCompatible 
- Ensure M implements MValueCompatible
- NewXY
- 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 href link e.g. { “Open S2”: “https://opens2.com/legal/data” }
- JSONProperties 
- Shape of an un-restricted features properties object
- LineString 
- Definition of a LineString
- LineString3D 
- Definition of a 3D LineString
- LineString3D Geometry 
- LineString3DGeometry is a 3D line
- LineString Geometry 
- LineStringGeometry is a line
- LineStringM Values 
- LineString Properties Shape
- MValue
- Shape of a feature’s M-Values object
- MapboxProperties 
- Shape of the restricted Mapbox properties object
- MultiLine String 
- Definition of a MultiLineString
- MultiLine String3D 
- Definition of a 3D MultiLineString
- MultiLine String3D Geometry 
- MultiLineString3DGeometry contains multiple 3D lines
- MultiLine String Geometry 
- MultiLineStringGeometry contains multiple lines
- MultiLine StringM Values 
- MultiLineString MValues Shape
- MultiPoint 
- Definition of a MultiPoint
- MultiPoint3D 
- Definition of a 3D MultiPoint
- MultiPoint3D Geometry 
- MultiPoint3DGeometry contains multiple 3D points
- MultiPoint Geometry 
- MultiPointGeometry contains multiple points
- MultiPolygon 
- Definition of a MultiPolygon
- MultiPolygon3D 
- Definition of a 3D MultiPolygon
- MultiPolygon3D Geometry 
- MultiPolygon3DGeometry is a 3D polygon with multiple polygons with their own potential holes
- MultiPolygon Geometry 
- MultiPolygonGeometry is a polygon with multiple polygons with their own potential holes
- MultiPolygonM Values 
- MultiPolygon MValues Shape
- Point3DGeometry 
- Point3DGeometry is a 3D point
- PointGeometry 
- PointGeometry is a point
- Polygon
- Definition of a Polygon
- Polygon3D
- Definition of a 3D Polygon
- Polygon3DGeometry 
- Polygon3DGeometry is a 3D polygon with potential holes
- PolygonGeometry 
- PolygonGeometry is a polygon with potential holes
- PolygonMValues 
- Polygon MValues Shape
- Properties
- Shape of a features properties object
- Shape
- The Shape Object
- ShapePrimitive 
- The Primitive Shape Object
- Value
- Shape design
- ValuePrimitive 
- Shape of a ValuePrimitiveType Nested object
- VectorLine Offset 
- An offset defines how far the starting line is from the original starting point pre-slice
- VectorLine String 
- Definition of a Vector LineString
- VectorLine String Geometry 
- LineStringGeometry is a line
- VectorMulti Line Offset 
- A collection of offsets
- VectorMulti Line String 
- Definition of a Vector MultiLineString
- VectorMulti Line String Geometry 
- MultiLineStringGeometry contains multiple lines
- VectorMulti Point 
- Definition of a Vector MultiPoint
- VectorMulti Point Geometry 
- MultiPointGeometry contains multiple points
- VectorMulti Polygon 
- Definition of a Vector MultiPolygon
- VectorMulti Polygon Geometry 
- MultiPolygonGeometry is a polygon with multiple polygons with their own potential holes
- VectorMulti Polygon Offset 
- A collection of collections of offsets
- VectorPoint Geometry 
- PointGeometry is a point
- VectorPolygon 
- Definition of a Vector Polygon
- VectorPolygon Geometry 
- PolygonGeometry is a polygon with potential holes
- VectorPolygon Offset 
- A collection of offsets
Derive Macros§
- JSONProperties derive
- Derives the JSONPropertiestrait for a struct to convert it to aJSONProperties.
- MValuederive
- Derives the MValuetrait for a struct to convert it to aMValue.
- MValueCompatible derive
- Derives the MValueCompatibletrait for a struct to convert it to aMValue.
- Propertiesderive
- Derives the Propertiestrait for a struct to convert it to aProperties.
- ValuePrimitive derive
- Derives the ValuePrimitivetrait for a struct to convert it to aValuePrimitive.