spatial_narrative/io/mod.rs
1//! Import and export of narratives in various formats.
2//!
3//! This module provides converters for reading and writing
4//! narratives in standard geographic data formats.
5//!
6//! # Supported Formats
7//!
8//! - [`GeoJsonFormat`] - Standard geographic data format
9//! - [`CsvFormat`] - Tabular data with configurable columns
10//! - [`JsonFormat`] - Custom JSON format optimized for narratives
11//! - GPX - GPS exchange format (optional feature, TODO)
12//!
13//! # Example
14//!
15//! ```rust
16//! use spatial_narrative::io::{GeoJsonFormat, CsvFormat, JsonFormat, Format};
17//! use spatial_narrative::prelude::*;
18//!
19//! let narrative = Narrative::builder()
20//! .title("My Story")
21//! .event(Event::builder()
22//! .location(Location::new(40.7128, -74.006))
23//! .timestamp(Timestamp::now())
24//! .text("Something happened")
25//! .build())
26//! .build();
27//!
28//! // Export to GeoJSON
29//! let geojson_format = GeoJsonFormat::new();
30//! let geojson = geojson_format.export_str(&narrative).unwrap();
31//!
32//! // Export to CSV
33//! let csv_format = CsvFormat::new();
34//! let csv = csv_format.export_str(&narrative).unwrap();
35//!
36//! // Export to custom JSON
37//! let json_format = JsonFormat::pretty();
38//! let json = json_format.export_str(&narrative).unwrap();
39//! ```
40
41mod csv_format;
42mod format;
43mod geojson;
44mod json_format;
45
46pub use csv_format::{CsvFormat, CsvOptions};
47pub use format::Format;
48pub use geojson::{GeoJsonFormat, GeoJsonOptions};
49pub use json_format::JsonFormat;