geozero 0.4.0

Zero-Copy reading and writing of geospatial data.
Documentation

Zero-Copy reading and writing of geospatial data.

GeoZero defines an API for reading geospatial data formats without an intermediate representation. It defines traits which can be implemented to read and convert to an arbitrary format or render geometries directly.

Supported geometry types:

Supported dimensions: X, Y, Z, M, T

Installation

[dependencies]
geozero = "0.2"

Zero-copy geometry reader

Geometries can be accessed by implementing the GeomProcessor trait.

use geozero::{GeomProcessor, error::Result};

struct CoordPrinter;

impl GeomProcessor for CoordPrinter {
fn xy(&mut self, x: f64, y: f64, _idx: usize) -> Result<()> {
Ok(println!("({} {})", x, y))
}
}

Zero-copy feature access

Properties can be accessed by implementing the PropertyProcessor trait.

use geozero::{PropertyProcessor, ColumnValue, error::Result};

struct PropertyPrinter;

impl PropertyProcessor for PropertyPrinter {
fn property(&mut self, i: usize, n: &str, v: &ColumnValue) -> Result<bool> {
println!("columnidx: {} name: {} value: {:?}", i, n, v);
Ok(false) // don't abort
}
}