spatio_types/lib.rs
1//! # spatio-types
2//!
3//! Core spatial and temporal data types for the Spatio database.
4//!
5//! This crate provides fundamental types for working with spatio-temporal data:
6//!
7//! - **Point types**: `Point`, `Point3d`, `TemporalPoint`, `TemporalPoint3D`
8//! - **Polygon types**: `Polygon`, `Polygon3D`, `PolygonDynamic`, `PolygonDynamic3D`
9//! - **Bounding box types**: `BoundingBox2D`, `BoundingBox3D`, `TemporalBoundingBox2D`, `TemporalBoundingBox3D`
10//!
11//! All types are serializable with Serde and built on top of the `geo` crate's
12//! geometric primitives.
13//!
14//! ## Features
15//!
16//! - **`geojson`** - Enable GeoJSON serialization/deserialization for types
17//!
18//! ## Examples
19//!
20//! ```rust
21//! use spatio_types::point::TemporalPoint;
22//! use spatio_types::bbox::BoundingBox2D;
23//! use spatio_types::geo::Point;
24//! use std::time::SystemTime;
25//!
26//! // Create a temporal point
27//! let point = Point::new(-74.0060, 40.7128); // NYC coordinates
28//! let temporal_point = TemporalPoint::new(point, SystemTime::now());
29//!
30//! // Create a bounding box
31//! let manhattan = BoundingBox2D::new(-74.0479, 40.6829, -73.9067, 40.8820);
32//! assert!(manhattan.contains_point(&point.into()));
33//! ```
34//!
35//! ## GeoJSON Support
36//!
37//! With the `geojson` feature enabled:
38//!
39//! ```rust
40//! # #[cfg(feature = "geojson")]
41//! # {
42//! use spatio_types::point::Point3d;
43//!
44//! let point = Point3d::new(-74.0060, 40.7128, 100.0);
45//! let json = point.to_geojson().unwrap();
46//! let parsed = Point3d::from_geojson(&json).unwrap();
47//! # }
48//! ```
49
50pub mod bbox;
51pub mod config;
52pub mod geo;
53pub mod point;
54pub mod polygon;
55pub mod stats;
56pub mod time;