Expand description
OxiGDAL GeoJSON Driver - RFC 7946 Implementation
This crate provides a pure Rust implementation of GeoJSON (RFC 7946) reading and writing for the OxiGDAL ecosystem. It supports all geometry types, features, feature collections, and coordinate reference systems.
§Features
- Full RFC 7946 compliance
- Support for all geometry types (Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection)
- Feature and FeatureCollection support
- CRS (Coordinate Reference System) handling
- Streaming reader for large files
- Efficient writer with customizable formatting
- Comprehensive validation
- Zero-copy optimizations where possible
- No
unwrap()orpanic!()in production code
§Example
use oxigdal_geojson::{GeoJsonReader, GeoJsonWriter, FeatureCollection};
use std::fs::File;
use std::io::{BufReader, BufWriter};
// Reading GeoJSON
let file = File::open(&input_path)?;
let reader = BufReader::new(file);
let mut geojson_reader = GeoJsonReader::new(reader);
let feature_collection = geojson_reader.read_feature_collection()?;
// Writing GeoJSON
let file = File::create(&output_path)?;
let writer = BufWriter::new(file);
let mut geojson_writer = GeoJsonWriter::new(writer);
geojson_writer.write_feature_collection(&feature_collection)?;§RFC 7946 Compliance
This implementation follows RFC 7946 strictly:
- Right-hand rule for polygon orientation
- WGS84 as default CRS (EPSG:4326)
- Longitude-latitude order for coordinates
- Validation of geometry topologies
- Support for bounding boxes
- Foreign members preserved during round-trip
§Performance
- Streaming API for large files (O(1) memory for features)
- Zero-copy deserialization where possible
- Efficient buffering and I/O
- Parallel processing support (with
asyncfeature)
§COOLJAPAN Policies
- Pure Rust implementation (no C/C++ dependencies)
- No
unwrap()orexpect()in production code - Comprehensive error handling
- Extensive testing (unit + integration + property-based)
- Clean API design following Rust idioms
Re-exports§
pub use error::GeoJsonError;pub use error::Result;pub use reader::GeoJsonReader;pub use types::Coordinate;pub use types::CoordinateSequence;pub use types::Crs;pub use types::Feature;pub use types::FeatureCollection;pub use types::Geometry;pub use types::GeometryType;pub use types::Position;pub use types::Properties;pub use validation::Validator;pub use writer::GeoJsonWriter;
Modules§
- error
- Error types for GeoJSON operations
- reader
- GeoJSON reader implementation
- types
- GeoJSON type definitions
- utils
- Utility modules for GeoJSON operations
- validation
- RFC 7946 validation utilities
- writer
- GeoJSON writer implementation
Constants§
- DEFAULT_
CRS - Default CRS for GeoJSON (WGS84)
- FILE_
EXTENSION - GeoJSON file extension
- MIME_
TYPE - GeoJSON MIME type
- NAME
- Crate name
- VERSION
- Crate version