Expand description
Types for OGC Features and Geometries JSON (JSON-FG), the OGC extension of GeoJSON standardized as OGC 21-045r1 (version 1.0).
JSON-FG is a strict superset of GeoJSON. It adds, as GeoJSON foreign members, the ability to convey:
- geometry in a coordinate reference system other than WGS 84, via the
placemember andcoordRefSys; - geometry types beyond GeoJSON: solids (
Geometry::Polyhedron,Geometry::Prism, …) and curves (Geometry::CircularString,Geometry::CurvePolygon, …); - temporal information via
time; - feature classification via
featureTypeandfeatureSchema.
This crate is the JSON-FG counterpart to the geojson crate: a serde-based data
model, with no I/O or content-negotiation logic. Enable the geojson feature for
conversions to and from geojson::Geometry.
§Example
use jsonfg::{conformance, CoordRefSys, Feature, Geometry};
// A feature whose geometry is a point in a projected CRS (EPSG:3857): the native
// geometry goes in `place`, and `geometry` (the GeoJSON member) is left null.
let mut feature = Feature::new();
feature.conforms_to = Some(vec![conformance::CORE.to_owned()]);
feature.coord_ref_sys = Some(CoordRefSys::from_epsg(3857));
feature.place = Some(Geometry::point(vec![100.0, 200.0]));
let json = serde_json::to_value(&feature).unwrap();
assert_eq!(json["place"]["type"], "Point");
assert!(json["geometry"].is_null());Modules§
- conformance
- Conformance-class URIs and the JSON-FG media type.
Structs§
- Feature
- A JSON-FG feature.
- Feature
Collection - A JSON-FG feature collection.
- Geometry
Meta - Optional members common to every JSON-FG geometry object.
- Measures
- Declares that positions in a geometry carry a trailing measure (
m) value, and optionally describes it. - Reference
- A
{"type": "Reference", "href": …, "epoch": …}coordinate reference system object. - Time
- The value of a feature’s
timemember: a temporal instant (as adateand/or atimestamp) and/or aninterval. At least one member must be present.
Enums§
- Coord
RefSys - The value of a
coordRefSysmember: a single reference, or (for a compound CRS) an array of at least two references. - Feature
Collection Kind - Marker for the
typemember of aFeatureCollection; always serializes as"FeatureCollection". - Feature
Kind - Marker for the
typemember of aFeature; always serializes as"Feature". - Feature
Schema - The value of the
featureSchemamember: a single schema URI, or a map from feature type name to schema URI (for multi-typed features). - Feature
Type - The value of the
featureTypemember: a single classifier, or several. - Geometry
- A JSON-FG geometry.
- Id
- A feature identifier: a string or a number.
- RefSys
- A single coordinate reference system: either a plain URI, or a by-reference object
that may pin a dynamic CRS to an
epoch. - Reference
Kind - Marker for the
typemember of aReference; always serializes as"Reference".
Constants§
- CRS84
- The OGC URI for WGS 84 longitude/latitude (2D), the JSON-FG default CRS.
- CRS84H
- The OGC URI for WGS 84 longitude/latitude/height (3D).
- UNBOUNDED
- The marker used for an unbounded end of a time
Time::interval.
Type Aliases§
- Bbox
- A bounding box: four numbers (2D) or six numbers (3D).
- Json
Object - A JSON object: an ordered map of string keys to arbitrary JSON values. Used for feature properties and for preserved foreign members.
- Position
- A single coordinate:
[x, y],[x, y, z], or[x, y, z, m](the trailingmvalue requires the Measures conformance class).