19 releases (6 stable)

4.0.0 Oct 14, 2023
3.27.0 Aug 29, 2023
3.26.1 Jul 19, 2023
3.25.0 Mar 8, 2023
0.3.0 Mar 20, 2020

#7 in Geospatial

Download history 106/week @ 2023-08-21 145/week @ 2023-08-28 197/week @ 2023-09-04 126/week @ 2023-09-11 137/week @ 2023-09-18 143/week @ 2023-09-25 89/week @ 2023-10-02 128/week @ 2023-10-09 153/week @ 2023-10-16 163/week @ 2023-10-23 180/week @ 2023-10-30 146/week @ 2023-11-06 95/week @ 2023-11-13 169/week @ 2023-11-20 164/week @ 2023-11-27 92/week @ 2023-12-04

539 downloads per month
Used in 6 crates

BSD-2-Clause

240KB
4.5K SLoC

FlatGeobuf for Rust

Rust implementation of FlatGeobuf.

FlatGeobuf is a performant binary encoding for geographic data based on flatbuffers that can hold a collection of Simple Features including circular interpolations as defined by SQL-MM Part 3.

Usage

use flatgeobuf::*;

fn main() {
    let mut filein = BufReader::new(File::open("countries.fgb")?);
    let mut fgb = FgbReader::open(&mut filein)?.select_all()?;
    while let Some(feature) = fgb.next()? {
        println!("{}", feature.property::<String>("name").unwrap());
        println!("{}", feature.to_json()?);
    }
}

With async HTTP client:

use flatgeobuf::*;

async fn process() {
    let mut fgb = HttpFgbReader::open("https://flatgeobuf.org/test/data/countries.fgb")
        .await?
        .select_bbox(8.8, 47.2, 9.5, 55.3)
        .await?;
    while let Some(feature) = fgb.next().await? {
        let props = feature.properties()?;
        println!("{}", props["name"]);
        println!("{}", feature.to_wkt()?);
    }
}

See documentation and tests for more examples.

Run tests and benchmarks

cargo test

cargo criterion

Run fuzzer

cargo install cargo-fuzz

cargo +nightly fuzz run read

Dependencies

~2–12MB
~131K SLoC