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