jsonfg 0.1.0

Types for OGC Features and Geometries JSON (JSON-FG), a GeoJSON superset with support for arbitrary coordinate reference systems, solids, and curved geometries.
Documentation
//! 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
//!   [`place`](Feature::place) member and [`coordRefSys`](CoordRefSys);
//! - geometry types beyond GeoJSON: solids ([`Geometry::Polyhedron`],
//!   [`Geometry::Prism`], …) and curves ([`Geometry::CircularString`],
//!   [`Geometry::CurvePolygon`], …);
//! - temporal information via [`time`](Feature::time);
//! - feature classification via [`featureType`](Feature::feature_type) and
//!   [`featureSchema`](Feature::feature_schema).
//!
//! 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());
//! ```
//!
//! [JSON-FG]: https://docs.ogc.org/is/21-045r1/21-045r1.html
//! [`geojson`]: https://docs.rs/geojson

#![forbid(unsafe_code)]

pub mod conformance;
mod crs;
mod feature;
mod feature_collection;
mod geometry;
mod measures;
mod time;

pub use crs::{CRS84, CRS84H, CoordRefSys, RefSys, Reference, ReferenceKind};
pub use feature::{Feature, FeatureKind, FeatureSchema, FeatureType, Id};
pub use feature_collection::{FeatureCollection, FeatureCollectionKind};
pub use geometry::{Bbox, Geometry, GeometryMeta, Position};
pub use measures::Measures;
pub use time::{Time, UNBOUNDED};

#[cfg(feature = "geojson")]
pub use geometry::NotGeoJson;

/// A JSON object: an ordered map of string keys to arbitrary JSON values. Used for
/// feature properties and for preserved foreign members.
pub type JsonObject = serde_json::Map<String, serde_json::Value>;