Skip to main content

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//! | [`raster`] *(feature-gated)* | Raster IR — `RasterTile`, `Band`, `PixelType`, `GeoTransform`, `RasterProfile`, `RasterLayer` trait |
23//!
24//! ## Why this crate exists
25//!
26//! Every format crate (filegdb, shapefile, geoparquet, mvt) reads/writes
27//! its bytes into the same `Feature` / `Geometry` / `Schema` types defined
28//! here. That sharing is what makes the workspace a coherent library
29//! instead of seven independent format codecs.
30//!
31//! ## Stability
32//!
33//! See `STABILITY.md` at the repo root. The growable IR enums
34//! (`Geometry`, `GeometryType`, `Value`, `ValueType`, `Crs`) are
35//! `#[non_exhaustive]` — adding variants in a SemVer-minor release does
36//! not count as a break.
37//!
38//! ## What's in here
39//!
40//! - [`Geometry`] — the geometry tree (Point/Multi*/Polygon/Collection)
41//! - [`Coord`] — a single coordinate, with optional `z` and `m`
42//! - [`Value`] / [`ValueType`] — attribute values and their type tags
43//! - [`Feature`] — `fid` + optional geometry + indexed attribute vector
44//! - [`Schema`] / [`FieldDef`] / [`GeomField`] — layer schema description
45//! - [`Crs`] — coordinate reference system (EPSG / WKT / PROJJSON)
46//! - [`Error`] — common error type
47//!
48//! ## Cargo features
49//!
50//! - `geo-types` *(off by default)* — `From`/`Into` conversions between this
51//!   crate's [`Geometry`] and [`geo_types::Geometry`], plus `Coord`. Z/M is
52//!   silently dropped because `geo-types` is 2D.
53//! - `raster` *(off by default)* — adds the [`raster`] module with the
54//!   raster IR (`RasterTile`, `Band`, `PixelType`, `GeoTransform`,
55//!   `RasterProfile`, `RasterLayer` trait). Required by `geonative-geotiff`
56//!   and any raster format / processing crate. Vector-only consumers
57//!   don't need this feature.
58
59#![forbid(unsafe_code)]
60#![warn(missing_debug_implementations)]
61
62pub mod crs;
63pub mod dataset;
64pub mod error;
65pub mod feature;
66pub mod geometry;
67pub mod schema;
68pub mod value;
69pub mod wkb;
70
71#[cfg(feature = "geo-types")]
72pub mod geo_types_interop;
73
74#[cfg(feature = "raster")]
75pub mod raster;
76
77pub use crs::Crs;
78pub use dataset::{Dataset, Layer, SingleLayerDataset};
79pub use error::{Error, Result};
80pub use feature::Feature;
81pub use geometry::{Coord, Geometry, GeometryType, LineString, Polygon};
82pub use schema::{FieldDef, GeomField, Schema};
83pub use value::{Value, ValueType};
84pub use wkb::bbox_from_bytes;
85
86/// Crate version, for diagnostic use.
87pub const VERSION: &str = env!("CARGO_PKG_VERSION");