49 releases (1 stable)

Uses new Rust 2024

1.0.0 Mar 16, 2026
0.24.2 Feb 24, 2025
0.24.1 May 17, 2023
0.24.0 Sep 9, 2022
0.0.1 Dec 4, 2014

#17 in Parser implementations

Download history 105360/week @ 2026-01-24 117771/week @ 2026-01-31 117160/week @ 2026-02-07 120101/week @ 2026-02-14 142827/week @ 2026-02-21 129926/week @ 2026-02-28 124217/week @ 2026-03-07 107981/week @ 2026-03-14 109258/week @ 2026-03-21 94622/week @ 2026-03-28 116955/week @ 2026-04-04 127745/week @ 2026-04-11 118517/week @ 2026-04-18 126540/week @ 2026-04-25 121061/week @ 2026-05-02 156407/week @ 2026-05-09

545,436 downloads per month
Used in 256 crates (165 directly)

MIT/Apache

235KB
4.5K SLoC

geojson

Documentation

Library for serializing the GeoJSON vector GIS file format

Minimum Rust Version

This library requires a minimum Rust version of 1.34 (released April 11 2019)

Examples

Reading

use geojson::GeoJson;

let geojson_str = r#"
{
    "type": "Feature",
    "properties": {
        "name": "Firestone Grill"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [-120.66029,35.2812]
    }
}
"#;

let geojson = geojson_str.parse::<GeoJson>().unwrap();

Writing

use geojson::{Feature, GeoJson, Geometry, JsonObject, JsonValue};

let geometry = Geometry::new_point([-120.66029, 35.2812]);

let mut properties = JsonObject::new();
properties.insert(
    String::from("name"),
    JsonValue::from("Firestone Grill"),
);

let geojson = GeoJson::Feature(Feature {
    bbox: None,
    geometry: Some(geometry),
    id: None,
    properties: Some(properties),
    foreign_members: None,
});

let geojson_string = geojson.to_string();

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~3–4.5MB
~89K SLoC