pub struct GeoJsonFormat {
pub options: GeoJsonOptions,
}Expand description
GeoJSON format handler.
This format handler can import and export narratives in GeoJSON format, storing events as Features with Point geometries. Temporal and metadata information is stored in feature properties.
§Example
use spatial_narrative::io::{GeoJsonFormat, Format};
use spatial_narrative::prelude::*;
let format = GeoJsonFormat::default();
// Import from GeoJSON
let geojson = r#"{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-74.006, 40.7128]
},
"properties": {
"text": "Something happened",
"timestamp": "2024-01-15T14:30:00Z"
}
}
]
}"#;
let narrative = format.import_str(geojson).unwrap();
assert_eq!(narrative.events().len(), 1);Fields§
§options: GeoJsonOptionsOptions for import/export behavior
Implementations§
Source§impl GeoJsonFormat
impl GeoJsonFormat
Sourcepub fn with_options(options: GeoJsonOptions) -> Self
pub fn with_options(options: GeoJsonOptions) -> Self
Create a new GeoJSON format handler with custom options.
Trait Implementations§
Source§impl Clone for GeoJsonFormat
impl Clone for GeoJsonFormat
Source§fn clone(&self) -> GeoJsonFormat
fn clone(&self) -> GeoJsonFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GeoJsonFormat
impl Debug for GeoJsonFormat
Source§impl Default for GeoJsonFormat
impl Default for GeoJsonFormat
Source§fn default() -> GeoJsonFormat
fn default() -> GeoJsonFormat
Returns the “default value” for a type. Read more
Source§impl Format for GeoJsonFormat
impl Format for GeoJsonFormat
Source§fn import<R: Read>(&self, reader: R) -> Result<Narrative>
fn import<R: Read>(&self, reader: R) -> Result<Narrative>
Import a narrative from a reader. Read more
Source§fn export<W: Write>(&self, narrative: &Narrative, writer: W) -> Result<()>
fn export<W: Write>(&self, narrative: &Narrative, writer: W) -> Result<()>
Export a narrative to a writer. Read more
Auto Trait Implementations§
impl Freeze for GeoJsonFormat
impl RefUnwindSafe for GeoJsonFormat
impl Send for GeoJsonFormat
impl Sync for GeoJsonFormat
impl Unpin for GeoJsonFormat
impl UnwindSafe for GeoJsonFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more