Spatiotemporal Event Analysis
A Rust library for modeling, indexing, and analyzing events that unfold across geographic space and chronological time. Built for researchers, digital humanists, and data scientists.
use spatial_narrative::prelude::*;
// Create a spatiotemporal event
let event = Event::builder()
.text("Conference in Paris")
.location(Location::new(48.8566, 2.3522))
.timestamp(Timestamp::parse("2024-03-15")?)
.build()?;
// Build a narrative collection
let mut narrative = Narrative::new("Research Trip");
narrative.add_event(event);
// Spatial query with R*-tree index
let nearby = index.nearest(&paris, 5);
// Extract entities from text
let entities = analyzer.extract_entities(text);
Flexible Event Representation
Events with WGS84 coordinates, multi-precision timestamps (year to second granularity), extensible metadata, and rich semantic tagging. Designed for heterogeneous historical and contemporary data.
Spatial Indexing
R*-tree and quadtree structures for efficient spatial queries. Nearest neighbor search, bounding box operations, and range queries with logarithmic complexity.
Text Processing
Pattern-based and ML-powered named entity recognition with BERT models via ONNX Runtime.
Movement Analysis
Trajectory simplification, speed calculation, stop detection, and clustering algorithms.
Format Support
Import and export JSON, GeoJSON, CSV, GPX tracks, and SQLite with full-text search.
Analysis Tools
DBSCAN and k-means clustering, temporal windowing, and statistical summaries.
Core Modules
Library Structure
| core | Location, Timestamp, Event, Narrative, GeoBounds — complete ✅ |
| index | SpatialIndex (R-tree), TemporalIndex, SpatiotemporalIndex, Heatmap — complete ✅ |
| graph | NarrativeGraph, DOT export, pathfinding — complete ✅ |
| analysis | Movement (trajectory, stops), Clustering (DBSCAN, KMeans), Spatial & Temporal metrics — mature ✅ |
| io | JSON, GeoJSON, CSV, (GPX optional), SQLite (optional, FTS) — adapters & examples |
| text | TextAnalyzer, KeywordExtractor, Entity extraction; ML-based NER available via ml-ner feature (optional) |
| parser | GeoParser, Gazetteer, Mention resolution (geoparsing) |
| transform | Coordinate transforms, distance & bearing utilities |