20 releases (7 stable)

4.1.0 Feb 24, 2024
4.0.0 Oct 14, 2023
3.27.0 Aug 29, 2023
3.26.1 Jul 19, 2023
0.3.0 Mar 20, 2020

#10 in Geospatial

Download history 42/week @ 2024-01-13 65/week @ 2024-01-20 109/week @ 2024-01-27 117/week @ 2024-02-03 128/week @ 2024-02-10 116/week @ 2024-02-17 341/week @ 2024-02-24 75/week @ 2024-03-02 103/week @ 2024-03-09 309/week @ 2024-03-16 101/week @ 2024-03-23 144/week @ 2024-03-30 62/week @ 2024-04-06 19/week @ 2024-04-13 26/week @ 2024-04-20 44/week @ 2024-04-27

170 downloads per month
Used in 8 crates

BSD-2-Clause

245KB
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

~3–17MB
~246K SLoC