26 releases (13 stable)

4.6.0 Feb 12, 2025
4.5.0 Dec 9, 2024
4.4.0 Sep 26, 2024
4.2.1 Jun 17, 2024
0.3.0 Mar 20, 2020

#8 in Geospatial

Download history 29/week @ 2024-12-22 30/week @ 2024-12-29 207/week @ 2025-01-05 214/week @ 2025-01-12 300/week @ 2025-01-19 322/week @ 2025-01-26 331/week @ 2025-02-02 506/week @ 2025-02-09 541/week @ 2025-02-16 494/week @ 2025-02-23 300/week @ 2025-03-02 426/week @ 2025-03-09 254/week @ 2025-03-16 632/week @ 2025-03-23 542/week @ 2025-03-30 382/week @ 2025-04-06

1,816 downloads per month
Used in 14 crates (11 directly)

BSD-2-Clause

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

~4–18MB
~267K SLoC