pub struct KmlReader<B: BufRead, T: CoordType + FromStr + Default = f64> { /* private fields */ }
Expand description

Main struct for reading KML documents

Implementations

Parse KML from string

Example
use kml::{Kml, KmlReader};

let point_str = "<Point><coordinates>1,1,1</coordinates></Point>";
let kml_point: Kml<f64> = KmlReader::from_string(point_str).read().unwrap();

Read KML from a file path

Example
use std::path::Path;
use kml::KmlReader;

let poly_path = Path::new(env!("CARGO_MANIFEST_DIR"))
    .join("tests")
    .join("fixtures")
    .join("polygon.kml");
let mut kml_reader = KmlReader::<_, f64>::from_path(poly_path).unwrap();
let kml = kml_reader.read().unwrap();

Read from any generic reader type

Read content into Kml

Example
use kml::{Kml, KmlReader};

let point_str = "<Point><coordinates>1,1,1</coordinates></Point>";
let kml_point: Kml<f64> = KmlReader::from_string(point_str).read().unwrap();
This is supported on crate feature zip only.

Create a KmlReader from a KMZ file path

Example
use std::path::Path;
use kml::KmlReader;

let kmz_path = Path::new(env!("CARGO_MANIFEST_DIR"))
    .join("tests")
    .join("fixtures")
    .join("polygon.kmz");
let mut kml_reader = KmlReader::<_, f64>::from_kmz_path(kmz_path).unwrap();
let kml = kml_reader.read().unwrap();

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.