geojson
Read and write GeoJSON vector geographic data
1.0.0
11M downloads/mo
#3040 most downloaded on crates.io
georust/geojson
What this package is like to depend on
Last release 5 months ago
16 Mar 2026
Release timing varies
gaps range from 2 months to 1.8 years
Most releases are documented
notes for 33 of 49 stable releases
1 version withdrawn
withdrawn after publishing
12 years old
50 releases · first in 2014
1 release in the last 12 months
see the full history below
Release timeline
50 releases · Dec 2014 to Mar 2026Releases
latest 50-
1.0.016 Mar 2026Release notes
Open source →- BREAKING:
Positionis now a struct, rather than a type alias forVec. The new struct uses the tinyvec crate, which allows for faster GeoJSON processing in the common (2-D) case by avoiding per-coordinate heap allocations.// BEFORE: Position *was* a Vec. A Vec is always allocated on the heap, which is slow. let position: Position = vec![1.0, 2.0]; let x = position[0]; // AFTER: Position is its own type, buildable *from* a Vec. let position: Position = vec![1.0, 2.0].into(); // index access is unchanged let x = position[0]; // Alternatively, you can now construct from an Array, avoiding the Vec's heap allocation. let position: Position = [1.0, 2.0].into(); // equivalently: let position = Position::from([1.0, 2.0]); // You can still build 3D+ Positions. These higher dimension coordinates will use Heap storage. let position = Position::from([1.0, 2.0, 3.0]); let position = Position::from(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); - Substantially speed up parsing (Benches show 30% reduction). This was essentially a rewrite of our deserialization logic. Instead of going from input -> serde_json::JsonObject -> geojson types we now go directly from input -> geojson types.
- Deserialization errors now include line number and column position.
Before:
Encountered neither number type nor string type for 'id' field on 'feature' object:
{}After: Error while deserializing GeoJSON: Feature 'id' must be a string or a number at line 3 column 11 - BREAKING:
geojson::Errorhas had many cases removed and some new cases added, reflecting the deserialization rewrite. - BREAKING: TryInto/From implementations for
serde_json::Valueandserde_json::Objecthave been removed now that they are not used for deserialization. typeis now the first field when serializing GeoJSON objects.- Since
feature.idis optional, we now accept "id: null", whereas previously you were required to omit theidkey. Now either is acceptable. - Fix: Return
[]instead of[[]]forPOLYGON EMPTY. - Potentially breaking: De/Serializing your custom structs with serde now maps
your struct's
idfield toFeature.id, rather than toFeature.properties.id. - Fix
geo_rect_conversion_testto conform to the correctly-woundPolygonoutput fromgeo_types::geometry::Rect.to_polygon - Decreased the size of the
Errorenum from 200 to 48. geojson::Valuehas been renamed togeojson::GeometryValuefor clarity. The old spelling is still available, but deprecated.- Add ergonomic constructors to
geojson::GeometryValue.// BEFORE let point = GeometryValue::Point(Position::from([1.0, 2.0])); let line_string = GeometryValue::LineString(vec![ Position::from([1.0, 2.0]), Position::from([3.0, 4.0]) ]); let geometry_collection = GeometryValue::GeometryCollection(vec![ Geometry::new(point), Geometry::new(line_string) ]); // AFTER let point = GeometryValue::new_point([1.0, 2.0]); let line_string = GeometryValue::new_line_string(vec![ [1.0, 2.0], [3.0 4.0] ]); let geometry_collection = GeometryValue::new_geometry_collection(vec![ point, line_string ]); - The
geojson::GeometryValueenum variants now have a named field, rather than a newtype.let position = Position::from([1,2]); // before let point = geojson::GeometryValue::Point(position); let geometry_collection = geojson::GeometryValue::GeometryCollection(vec![point.into()]); // after let point = geojson::GeometryValue::Point { coordinates: position }; let geometry_collection = geojson::GeometryValue::GeometryCollection { geometries: vec![point.into()] }; // or using the new constructor let point = geojson::GeometryValue::new_point(position);
- BREAKING:
-
0.24.224 Feb 2025Release notes
Open source →- Add
to_featureto convert a single S: Serialize to a Feature - Add
from_featureto convert a single Feature to a D: Deserialize - Upgrade from thiserror v1 to v2
- Add support of serializing optional
geo-typeswithserialize_optional_geometry. - Add support of deserializing optional
geo-typeswithdeserialize_optional_geometry. - Add support for foreign members to
FeatureWriter. - Added conversion from
Vec<Feature>toGeoJson. - Changed
Serializeimpls to avoid creating intermediateJsonObjects. - Better CI: lint, all features
- Implement
DefaultonFeatureCollection. - Added
GeometryCollection::try_from(&GeoJson)and deprecatedquick_collectionfor conventional naming and simpler docs. - Added
GeoJson::to_string_prettyas convenience wrappers around the sameserde_jsonmethods. - The
bboxproperty of aFeaturecan now benull(returningNone) when parsing GeoJSON strings in order to facilitate easier processing of GeoJSON "in the wild" (e.g. Copernicus STAC GeoJSON). The spec does not allow this, but implementations appear to disagree.
- Add
-
0.24.117 May 2023Release notes
Open source →- Modified conversion from JSON to reject zero- and one-dimensional positions.
-
0.24.009 Sep 2022Release notes
Open source →- Added
geojson::{ser, de}helpers to convert your custom struct to and from GeoJSON.- For external geometry types like geo-types, use the
serialize_geometry/deserialize_geometryhelpers. - Example:
#[derive(Serialize, Deserialize)] struct MyStruct { #[serde(serialize_with = "serialize_geometry", deserialize_with = "deserialize_geometry")] geometry: geo_types::Point<f64>, name: String, age: u64, } // read your input let my_structs: Vec<MyStruct> = geojson::de::deserialize_feature_collection(geojson_reader).unwrap(); // do some processing process(&mut my_structs); // write back your results geojson::ser::to_feature_collection_string(&my_structs).unwrap(); - PR: https://github.com/georust/geojson/pull/199
- For external geometry types like geo-types, use the
- Added
geojson::{FeatureReader, FeatureWriter}to stream the reading/writing of your custom struct to and from GeoJSON, greatly reducing the memory required to process a FeatureCollection. - Added IntoIter implementation for FeatureCollection.
- Added
geojson::Result<T>. - Added
TryFrom<&geometry::Value>for geo_type variants. - Changed the Display string of the error produced when converting a geometry to an incompatible type - e.g. a LineString into a Point.
- Fix: FeatureIterator errors when reading "features" field before "type" field.
- BREAKING: Change the Result type of FeatureIterator from io::Result to crate::Result
- Added
-
0.23.002 Jun 2022Release notes
Open source →- Enable optional geo-types integration by default.
- FIX: converting a single GeometryCollection Feature to geo_types
-
0.22.427 May 2022Release notes
Open source →- Allow parsing
Feature/FeatureCollectionthat are missing a"properties"key. - Overhauled front page documentation.
- Parse
Geometry/Feature/FeatureCollectiondirectly from str rather than viaGeoJsonwhen you know what you're expecting. Featurenow derivesDefault- Reexport
JsonObjectandJsonValuefromserde_json.
- Allow parsing
-
0.22.328 Mar 2022Release notes
Open source →- Added
FromIterator<Feature>impl forFeatureCollection - Added
'FeatureIteratorstreaming feature collection deserializer
- Added
-
0.22.219 Apr 2021Release notes
Open source →This is a quick followup release to 0.22.1, which was mistakenly
published by me before updating my local master.See the 0.22.1 tag (9152be1) for details.
There shouldn't be any problems for users of the interstitial 0.22.1
release, it just has slightly less new features.Release notes
Open source →- Added convenience methods to convert from geo_types::Geometry directly to GeoJson
-
0.22.119 Apr 2021 withdrawn -
0.22.002 Feb 2021 -
0.21.007 Dec 2020 -
0.20.124 Oct 2020Nothing published for this version
-
0.20.019 Oct 2020Release notes
Open source →- Switch to thiserror
- Add more granular errors
GeoJsonUnknownTypehas been split intoNotAFeatureandEmptyType
- Add additional Value context to errors where possible
- Add conversions from Geo-Types Line, Triangle, Rect and GeometryCollection
-
0.19.022 Jun 2020Release notes
Open source →- Update
geo-typesto 0.6.0 - Remove unnecessary allocations when parsing
GeometryCollection
- Update
-
0.18.023 Mar 2020Release notes
Open source →- Update
geo-typesto 0.5.0 - Update docs
- Add quick_collection function
- Add TryFrom impls for JsonObject and JsonValue
- Add from_json_value! macro
- Update
-
0.17.028 Dec 2019Release notes
Open source →- Add
TryFromimpls forJsonObjectandJsonValue - Add
from_json_valueforGeoJsonenum
- Add
-
0.16.005 May 2019Release notes
Open source →- Switch to Rust 2018 Edition
- Switch to
std::TryFromtrait from custom in-crateTryFromtrait - Implement
DisplayforFeature,Geometry, andFeatureCollection - Make the
geo-typesconversion functionality opt-in
-
0.15.017 Feb 2019 -
0.14.013 Jan 2019 -
0.13.011 Nov 2018Release notes
Open source →- Feature::id should either be a string or number; introduce
feature::Id - Fix broken GeoJSON links in docs
- Improve error message for mismatched type
- Performance improvements
- Feature::id should either be a string or number; introduce
-
0.12.016 Aug 2018 -
0.11.108 Jul 2018 -
0.11.004 May 2018 -
0.10.028 Apr 2018Release notes
Open source →- Deserialize Optimizations
- Expand docs with parsing examples and corner cases, and enable conversion docs
- Update GeoJSON spec links to point to published standard
- Bump geo and num-traits crates.
- Bump geo dependency: 0.7 -> 0.8.
-
0.9.129 Nov 2017Nothing published for this version
-
0.9.009 Sep 2017Release notes
Open source →- Don't publicize
assert_almost_eqmacro - Bump geo: 0.4 → 0.6
- Use docs.rs for documentation links
- Don't publicize
-
0.8.123 May 2017Nothing published for this version
-
0.8.002 May 2017 -
0.7.130 Apr 2017 -
0.7.029 Apr 2017 -
0.6.026 Mar 2017 -
0.5.004 Feb 2017 -
0.4.301 Jan 2017 -
0.4.210 Dec 2016 -
0.4.101 Nov 2016 -
0.4.007 Aug 2016 -
0.3.010 May 2016 -
0.2.119 Apr 2016Nothing published for this version
-
0.2.016 Mar 2016Nothing published for this version
-
0.1.109 Mar 2016Nothing published for this version
-
0.1.022 May 2015Nothing published for this version
-
0.0.920 Apr 2015Nothing published for this version
-
0.0.818 Apr 2015Nothing published for this version
-
0.0.704 Apr 2015Nothing published for this version
-
0.0.604 Apr 2015Nothing published for this version
-
0.0.521 Feb 2015Nothing published for this version
-
0.0.415 Feb 2015Nothing published for this version
-
0.0.310 Jan 2015Nothing published for this version
-
0.0.208 Jan 2015Nothing published for this version
-
0.0.104 Dec 2014Nothing published for this version