OxiGDAL Node.js Bindings
Production-ready Node.js bindings for OxiGDAL - Pure Rust geospatial data processing
Features
- Pure Rust Performance: No C/C++ dependencies, full native performance
- Zero-Copy Buffers: Efficient data transfer between Node.js and Rust
- Async/Await Support: Promise-based async operations for I/O and processing
- TypeScript Definitions: Full TypeScript support with comprehensive type definitions
- Comprehensive APIs: Raster I/O, vector operations, terrain analysis, and more
- Cloud-Native: COG (Cloud Optimized GeoTIFF) support built-in
- Cross-Platform: Works on Linux, macOS, and Windows (x64, ARM64)
Installation
Or with yarn:
Quick Start
Raster Operations
const oxigdal = require;
// Open a raster file
const dataset = oxigdal.;
console.log;
console.log;
// Read a band
const band = dataset.;
const stats = band.;
console.log;
// Create output
const output = oxigdal.;
output.;
output.;
Terrain Analysis
const oxigdal = require;
.;
Vector Operations
const oxigdal = require;
// Read GeoJSON
const collection = oxigdal.;
console.log;
// Create new feature
const point = oxigdal.;
const feature = ;
feature.;
collection.;
// Buffer operation
const buffered = oxigdal.;
// Area calculation
const polygon = oxigdal.;
const area = oxigdal.;
console.log;
// Save
oxigdal.;
API Documentation
Raster API
Dataset
// Create or open
const dataset = oxigdal.;
const dataset = oxigdal.;
// Properties
dataset.
dataset.
dataset.
dataset.
dataset.
dataset.
// Geo transform
dataset.;
const gt = dataset.;
// Coordinate conversion
const geo = dataset.;
const pixel = dataset.;
// Band I/O
const band = dataset.;
dataset.;
const window = dataset.;
// Save
dataset.;
BufferWrapper
// Create
const buffer = ;
// Pixel access
buffer.;
const value = buffer.;
// Operations
buffer.;
const stats = buffer.; // { min, max, mean, stddev, count }
const cloned = buffer.;
// Node.js Buffer conversion
const nodeBuffer = buffer.;
const buffer = oxigdal.;
Vector API
Geometry
// Create geometries
const point = oxigdal.;
const linestring = oxigdal.;
const polygon = oxigdal.;
// Properties
geometry.
geometry. // [minX, minY, maxX, maxY]
// GeoJSON
const geojson = geometry.;
const geometry = oxigdal.;
Feature & FeatureCollection
// Features
const feature = ;
feature.;
const value = feature.;
const geojson = feature.;
// Collections
const collection = ;
collection.;
const feature = collection.;
const count = collection.;
// I/O
const collection = oxigdal.;
oxigdal.;
Algorithm API
Resampling
const resampled = oxigdal.;
// Methods: NearestNeighbor, Bilinear, Bicubic, Lanczos
Terrain Analysis
// Hillshade
const hillshade = oxigdal.;
// Slope (degrees or percent)
const slope = oxigdal.;
// Aspect
const aspect = oxigdal.;
// Zonal statistics
const stats = oxigdal.;
// Returns: [{ zoneId, count, min, max, mean, stddev, sum }, ...]
Vector Algorithms
// Buffer
const buffered = oxigdal.;
// Area
const area = oxigdal.;
// Simplify
const simplified = oxigdal.;
Async API
All major operations have async variants:
// Raster I/O
const dataset = await oxigdal.;
await oxigdal.;
// Vector I/O
const collection = await oxigdal.;
await oxigdal.;
// Processing
const resampled = await oxigdal.;
const hillshade = await oxigdal.;
const slope = await oxigdal.;
const aspect = await oxigdal.;
const stats = await oxigdal.;
// Batch processing
const paths = await oxigdal.;
const result = await oxigdal.;
Stream Processing
For large datasets:
const stream = ;
let chunk;
while
Cancellation
const token = ;
// Start operation
const promise = oxigdal.;
// Cancel if needed
setTimeout;
// Check status
if
Data Types
Supported raster data types:
'uint8'- Unsigned 8-bit integer'int16'- Signed 16-bit integer'uint16'- Unsigned 16-bit integer'int32'- Signed 32-bit integer'uint32'- Unsigned 32-bit integer'float32'- 32-bit floating point'float64'- 64-bit floating point
Supported Formats
Raster
- GeoTIFF (.tif, .tiff) - Full support including COG
- More formats coming soon
Vector
- GeoJSON (.json, .geojson) - Full support
Examples
See the examples/ directory for complete examples:
01_basic_raster.js- Basic raster I/O and operations02_terrain_analysis.js- DEM processing and terrain analysis03_vector_operations.js- Vector I/O and geometry operations04_async_batch.js- Async operations and batch processing
Run examples:
Testing
Run with coverage:
Performance
OxiGDAL Node.js bindings are designed for production use with:
- Zero-copy data transfer where possible
- SIMD vectorization (x86_64 AVX2, ARM NEON)
- Multi-threaded operations via Rust's async runtime
- Optimized memory usage with custom allocators
TypeScript
Full TypeScript support is included:
import * as oxigdal from '@oxigdal/node';
const dataset: oxigdal.Dataset = oxigdal.openRaster('input.tif');
const band: oxigdal.BufferWrapper = dataset.readBand(0);
const stats: oxigdal.Statistics = band.statistics();
async function process(): Promise<void> {
const hillshade = await oxigdal.hillshadeAsync(band, 315, 45, 1.0);
// ...
}
Error Handling
All operations use standard JavaScript errors:
try catch
Platform Support
- Linux: x86_64, aarch64 (glibc and musl)
- macOS: x86_64, Apple Silicon (M1/M2)
- Windows: x86_64, aarch64 (ARM64)
Building from Source
Requirements:
- Rust 1.85+
- Node.js 16+
License
Apache-2.0
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Links
Authors
COOLJAPAN OU (Team Kitasan)
OxiGDAL - Pure Rust geospatial processing for the modern age.