Skip to main content

Crate oxigdal_node

Crate oxigdal_node 

Source
Expand description

Node.js bindings for OxiGDAL

This crate provides comprehensive Node.js bindings for the OxiGDAL ecosystem, enabling pure Rust geospatial processing from JavaScript/TypeScript with zero-copy Buffer integration and full async/await support.

§Features

  • Raster I/O: Read and write GeoTIFF, COG, and other raster formats
  • Vector I/O: GeoJSON support with full geometry operations
  • Algorithms: Resampling, terrain analysis, calculator, statistics
  • Async/Await: Promise-based async operations for I/O and processing
  • Buffer Integration: Zero-copy data transfer with Node.js Buffers
  • TypeScript: Comprehensive TypeScript definitions included

§Example Usage

const oxigdal = require('@oxigdal/node');

// Open a raster file
const dataset = oxigdal.openRaster('input.tif');
console.log(`Size: ${dataset.width}x${dataset.height}`);

// Read a band
const band = dataset.readBand(0);
const stats = band.statistics();
console.log(`Mean: ${stats.mean}, StdDev: ${stats.stddev}`);

// Compute hillshade
const hillshade = oxigdal.hillshade(band, 315, 45, 1.0);

// Save result
const output = oxigdal.createRaster(dataset.width, dataset.height, 1, 'uint8');
output.writeBand(0, hillshade);
output.save('hillshade.tif');

§Async Example

const oxigdal = require('@oxigdal/node');

async function processRaster() {
  const dataset = await oxigdal.openRasterAsync('input.tif');
  const band = dataset.readBand(0);
  const slope = await oxigdal.slopeAsync(band, 1.0, false);

  const output = oxigdal.createRaster(dataset.width, dataset.height, 1, 'float32');
  output.writeBand(0, slope);
  await oxigdal.saveRasterAsync(output, 'slope.tif');
}

processRaster().catch(console.error);

Structs§

DataTypes
Data type constants
ModuleInfo
Module information
ResamplingMethods
Resampling method constants

Functions§

get_data_types
Returns available data types
get_info
Returns module information
get_resampling_methods
Returns available resampling methods
name
Returns the OxiGDAL name
version
Returns the version of OxiGDAL