oxigdal-core
Core abstractions for OxiGDAL - a Pure Rust GDAL reimplementation with zero-copy buffers and cloud-native support for modern geospatial computing.
Features
- Pure Rust - No C/Fortran dependencies, builds anywhere Rust runs
- Zero-copy buffers - Efficient memory management with optional Apache Arrow integration
- Cloud-native - Designed for S3, GCS, Azure Blob, and other cloud object stores
- No-std support - Core types work in embedded and WASM environments
- Type-safe - Strongly typed pixel data types and georeferencing
- No unwrap policy - All fallible operations return
Result<T, E> - SIMD-accelerated - High-performance raster operations
- Async-ready - Optional async I/O traits for non-blocking operations
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Feature Flags
std(default) - Enable standard library supportalloc- Enable allocation support without full std (for no-std environments)arrow- Enable Apache Arrow integration for zero-copy interoperabilityasync- Enable async I/O traits
Example with arrow support:
[]
= { = "0.1.0", = ["arrow"] }
Quick Start
use ;
use RasterBuffer;
Core Types
Spatial Types
BoundingBox- 2D spatial extent with intersection, union, and buffering operationsBoundingBox3D- 3D spatial extent with elevationGeoTransform- Affine transformation for converting pixel coordinates to geographic coordinatesPixelExtent- Raster extent in pixel space
Raster Types
RasterDataType- Pixel data types (UInt8, UInt16, Int16, Float32, Float64, etc.)RasterBuffer- Typed buffer for raster data with zero-copy operationsRasterMetadata- Complete raster metadata (dimensions, CRS, bands, etc.)RasterStatistics- Min, max, mean, stddev for raster analysisNoDataValue- Type-safe representation of missing/invalid dataColorInterpretation- Band meaning (Gray, Red, Green, Blue, Alpha, etc.)PixelLayout- Memory organization (Interleaved, Band-sequential, etc.)
Vector Types
GeometryType- Point, LineString, Polygon, and Multi-geometry types
Usage
Working with Bounding Boxes
use BoundingBox;
// Create a bounding box
let bbox1 = new?;
let bbox2 = new?;
// Intersection
let intersection = bbox1.intersection?;
println!;
// Union
let union_bbox = bbox1.union;
println!;
// Buffer by 5 units
let buffered = bbox1.buffer?;
println!;
Geotransform Operations
use GeoTransform;
// Create north-up geotransform (simple case)
let gt = north_up;
// Convert pixel coordinates to geographic
let = gt.pixel_to_geo;
println!;
// Convert geographic to pixel coordinates
let = gt.geo_to_pixel?;
println!;
// Get resolution
let = gt.resolution;
println!;
Raster Buffers
use RasterBuffer;
use RasterDataType;
// Create a buffer filled with zeros
let buffer = zeros;
// Create from existing data
let data: = vec!;
let buffer = from_vec?;
// Access pixel value
if let Some = buffer.get_pixel
Raster Metadata
use ;
let metadata = RasterMetadata ;
println!;
println!;
println!;
API Overview
| Module | Description |
|---|---|
types |
Core geospatial types (BoundingBox, GeoTransform, RasterDataType) |
buffer |
Typed raster buffers with zero-copy operations |
simd_buffer |
SIMD-accelerated raster operations |
memory |
Memory management and allocation strategies |
io |
I/O traits for reading and writing geospatial data |
vector |
Vector geometry types and operations |
error |
Error types with descriptive messages |
tutorials |
Tutorial and example documentation |
Performance
OxiGDAL-core is designed for high performance:
- Zero-copy operations - Minimize memory allocations
- SIMD acceleration - Leverage CPU vector instructions for bulk operations
- Apache Arrow integration - Seamless interop with data science tools
- Cache-friendly layouts - Optimized memory access patterns
Benchmarks (Apple M1 Pro):
| Operation | Time | Throughput |
|---|---|---|
| Buffer creation (1M pixels) | 0.5ms | 2 GB/s |
| Pixel access | 2ns | 500M pixels/s |
| Geotransform | 3ns | 333M transforms/s |
Run benchmarks:
Project Statistics
- ~7,000 lines of code (Rust)
- ~1,750 lines of documentation
- 24 source files
- Zero unsafe code in core types
Error Handling
This library follows the "no unwrap" policy. All fallible operations return Result<T, OxiGdalError> with descriptive error messages:
use BoundingBox;
// Invalid bounding box (min > max)
let result = new;
assert!;
match result
Pure Rust
This library is 100% Pure Rust with no C/Fortran dependencies. All functionality works out of the box without external libraries or system dependencies. Perfect for:
- Cross-compilation to any platform
- WebAssembly (WASM) targets
- Embedded systems
- Reproducible builds
OxiGDAL Ecosystem
oxigdal-core is the foundation of the OxiGDAL ecosystem:
- oxigdal-core - Core types and traits (this crate)
- oxigdal-algorithms - Raster and vector algorithms
- oxigdal-drivers - Format drivers (GeoTIFF, NetCDF, Zarr, GeoJSON, etc.)
- oxigdal-cloud - Cloud object store integration
- oxigdal-server - Geospatial API server
- oxigdal-wasm - WebAssembly bindings
- oxigdal-python - Python bindings
See the main OxiGDAL repository for the complete ecosystem.
COOLJAPAN Ecosystem
Part of the COOLJAPAN Pure Rust scientific computing ecosystem:
- SciRS2 - Scientific computing primitives (NumPy-like)
- OxiBLAS - Pure Rust BLAS operations
- Oxicode - Binary serialization (bincode successor)
- OxiFFT - Fast Fourier Transform
Documentation
- API Documentation: docs.rs/oxigdal-core
- Tutorials: See the
tutorialsmodule for comprehensive guides - Main Project: github.com/cool-japan/oxigdal
Contributing
Contributions are welcome! Please read CONTRIBUTING.md in the main repository.
Development
# Run tests
# Run benchmarks
# Check with all features
# Test no-std compatibility
License
Licensed under the Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0).
Authors
COOLJAPAN OU (Team Kitasan)
Part of the COOLJAPAN ecosystem - Building the future of scientific computing in Pure Rust.