oxigdal-algorithms
High-performance geospatial processing algorithms for raster and vector data.
Overview
oxigdal-algorithms provides production-ready implementations of common geospatial algorithms:
- Resampling: Nearest, Bilinear, Bicubic, Lanczos
- Raster operations: Calculator, Hillshade, Slope/Aspect, Reclassification
- Vector operations: Buffer, Intersection, Union, Simplification
- Performance: SIMD optimizations, parallel processing
All algorithms are implemented in pure Rust with no external dependencies.
Features
simd: Enable SIMD optimizations (2-8x speedup)parallel: Enable parallel processing with rayonstd(default): Standard library support
Installation
[]
= "0.1"
# For maximum performance:
= { = "0.1", = ["simd", "parallel"] }
Quick Start
Resampling
use ;
use RasterBuffer;
use RasterDataType;
// Create source raster
let src = zeros;
// Resample to different dimensions
let resampler = new;
let dst = resampler.resample?;
println!;
Hillshade
use Hillshade;
let dem = zeros;
let hillshade = new
.azimuth // Light from NW
.altitude // 45° above horizon
.z_factor
.cell_size; // 30m resolution
let shaded = hillshade.compute?;
Raster Calculator
use RasterCalculator;
let input1 = zeros;
let input2 = zeros;
let calc = new;
// Simple operations
let sum = calc.add?;
let scaled = calc.multiply_scalar?;
// Complex expressions
let result = calc.evaluate?;
Resampling Methods
| Method | Speed | Quality | Best For |
|---|---|---|---|
| Nearest | ⭐⭐⭐⭐⭐ | ⭐⭐ | Categorical data |
| Bilinear | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Continuous data, DEMs |
| Bicubic | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | High-quality imagery |
| Lanczos | ⭐⭐ | ⭐⭐⭐⭐⭐ | Maximum quality |
Choosing a Method
// For classification/land cover
let resampler = new;
// For elevation data
let resampler = new;
// For high-quality satellite imagery
let resampler = new;
// For maximum quality (publication)
let resampler = new;
Raster Operations
Slope and Aspect
use ;
let dem = zeros;
// Calculate slope in degrees
let slope_calc = new
.cell_size
.units_degrees;
let slope = slope_calc.compute?;
// Calculate aspect (direction of steepest descent)
let aspect_calc = new.cell_size;
let aspect = aspect_calc.compute?;
Reclassification
use Reclassify;
use HashMap;
let mut rules = new;
rules.insert; // 0-10 → class 1
rules.insert; // 10-20 → class 2
rules.insert; // 20-100 → class 3
let reclass = new;
let classified = reclass.compute?;
Zonal Statistics
use ZonalStats;
let values = zeros;
let zones = zeros;
let zonal = new;
let stats = zonal.compute?;
for in stats
Vector Operations
Buffer
use Buffer;
use Geometry;
let point = Point ;
let buffered = new
.distance
.resolution
.compute?;
Douglas-Peucker Simplification
use DouglasPeucker;
let simplified = new
.tolerance
.compute?;
println!;
Performance
SIMD Acceleration
Enable SIMD for 2-8x speedup:
[]
= { = "0.1", = ["simd"] }
Supported:
- x86_64: AVX2, SSE4.2
- ARM: NEON
- WebAssembly: SIMD128
Parallel Processing
Enable rayon for near-linear scaling:
[]
= { = "0.1", = ["parallel"] }
let resampler = new
.parallel
.threads;
Benchmarks
Run benchmarks (requires nightly):
Example results (4096x4096 to 1024x1024):
| Method | Time (no SIMD) | Time (SIMD) | Speedup |
|---|---|---|---|
| Nearest | 12ms | 3ms | 4.0x |
| Bilinear | 98ms | 24ms | 4.1x |
| Bicubic | 287ms | 76ms | 3.8x |
Examples
See the examples/ directory:
COOLJAPAN Policies
- ✅ Pure Rust - No C/Fortran dependencies
- ✅ No unwrap() - All errors handled
- ✅ SIMD optimized - Maximum performance
- ✅ Well tested - Comprehensive test suite
License
Licensed under Apache-2.0.
Copyright © 2025 COOLJAPAN OU (Team Kitasan)