geonative_core/lib.rs
1//! # geonative-core
2//!
3//! The data model + WKB codec + object-safe `Dataset`/`Layer` traits that
4//! every other geonative crate builds on. Zero-dep (apart from `thiserror`)
5//! and the optional `geo-types` feature for ecosystem interop.
6//!
7//! ## What's in it
8//!
9//! Pick one of these as your starting point depending on what you're doing:
10//!
11//! | Module | What it gives you |
12//! | --- | --- |
13//! | [`geometry`] | `Coord`, `Geometry` (Simple Features tree), `LineString`, `Polygon`, `GeometryType` |
14//! | [`value`] | `Value` (attribute payload) + `ValueType` (schema discriminant) |
15//! | [`schema`] | `Schema` + `FieldDef` + `GeomField` — table-of-contents for one layer |
16//! | [`feature`] | `Feature` — fid + geometry + attributes |
17//! | [`crs`] | `Crs` enum (Unknown / Epsg / Wkt / Projjson) + EPSG resolution |
18//! | [`wkb`] | OGC SF WKB encoder + decoder + alloc-free bbox walker |
19//! | [`dataset`] | Object-safe `Dataset` / `Layer` traits for format-polymorphic code |
20//! | [`error`] | Crate-wide `Error` + `Result` |
21//! | [`geo_types_interop`] *(feature-gated)* | Conversions to/from the `geo-types` crate |
22//!
23//! ## Why this crate exists
24//!
25//! Every format crate (filegdb, shapefile, geoparquet, mvt) reads/writes
26//! its bytes into the same `Feature` / `Geometry` / `Schema` types defined
27//! here. That sharing is what makes the workspace a coherent library
28//! instead of seven independent format codecs.
29//!
30//! ## Stability
31//!
32//! See `STABILITY.md` at the repo root. The growable IR enums
33//! (`Geometry`, `GeometryType`, `Value`, `ValueType`, `Crs`) are
34//! `#[non_exhaustive]` — adding variants in a SemVer-minor release does
35//! not count as a break.
36//!
37//! ## What's in here
38//!
39//! - [`Geometry`] — the geometry tree (Point/Multi*/Polygon/Collection)
40//! - [`Coord`] — a single coordinate, with optional `z` and `m`
41//! - [`Value`] / [`ValueType`] — attribute values and their type tags
42//! - [`Feature`] — `fid` + optional geometry + indexed attribute vector
43//! - [`Schema`] / [`FieldDef`] / [`GeomField`] — layer schema description
44//! - [`Crs`] — coordinate reference system (EPSG / WKT / PROJJSON)
45//! - [`Error`] — common error type
46//!
47//! ## Cargo features
48//!
49//! - `geo-types` *(off by default)* — `From`/`Into` conversions between this
50//! crate's [`Geometry`] and [`geo_types::Geometry`], plus `Coord`. Z/M is
51//! silently dropped because `geo-types` is 2D.
52
53#![forbid(unsafe_code)]
54#![warn(missing_debug_implementations)]
55
56pub mod crs;
57pub mod dataset;
58pub mod error;
59pub mod feature;
60pub mod geometry;
61pub mod schema;
62pub mod value;
63pub mod wkb;
64
65#[cfg(feature = "geo-types")]
66pub mod geo_types_interop;
67
68pub use crs::Crs;
69pub use dataset::{Dataset, Layer, SingleLayerDataset};
70pub use error::{Error, Result};
71pub use feature::Feature;
72pub use geometry::{Coord, Geometry, GeometryType, LineString, Polygon};
73pub use schema::{FieldDef, GeomField, Schema};
74pub use value::{Value, ValueType};
75pub use wkb::bbox_from_bytes;
76
77/// Crate version, for diagnostic use.
78pub const VERSION: &str = env!("CARGO_PKG_VERSION");