The geo crate provides geospatial primitive types such as Coordinate, Point, LineString, and Polygon as
well as their Multi– equivalents, and provides algorithms and operations such as:
- Area and centroid calculation
- Simplification and convex hull operations
- Distance measurement
- Intersection checks
- Affine transforms such as rotation and translation.
The primitive types also provide the basis for other functionality in the Geo ecosystem, including:
- Serialization to and from GeoJSON and WKT
- Coordinate transformation and projection
- Geocoding
- Working with GPS data
…allowing these crates to interoperate; GeoJSON can readily be read from a file, deserialised, transformed
to a local datum, modified, transformed back to WGS84, and serialised back to GeoJSON.
Operations available for primitive types can be found in the algorithm module, along with
comprehensive usage examples.
While Geo is primarily intended to operate on planar geometries, some other useful algorithms are
provided: Haversine, Frechet, and Vincenty distances, as well as Chamberlain-Duquette area.
Optional Features (these can be activated in your cargo.toml)
The following optional features are available:
use-proj: enable coordinate conversion and transformation ofPointgeometries using theprojcrateuse-serde: enable serialisation of geometries usingserde.
GeoJSON
If you wish to read or write GeoJSON, use the geojson crate, with the geo-types feature activated.
This provides fallible conversions to geo-types primitives such as Point and Polygon from geojson Value
structs using the standard TryFrom
and TryInto traits,
and conversion from geo-types primitives to geojson
Value structs using the From trait.