Skip to main content

Module buffer

Module buffer 

Source
Expand description

Buffer types for raster and vector data

This module provides efficient buffer types for storing and manipulating geospatial data. When the arrow feature is enabled, buffers are backed by Apache Arrow arrays for zero-copy interoperability.

§Overview

The RasterBuffer type is the core buffer abstraction in OxiGDAL, providing type-safe storage for raster pixel data with automatic memory management.

§Examples

§Creating buffers

use oxigdal_core::buffer::RasterBuffer;
use oxigdal_core::types::{RasterDataType, NoDataValue};

// Create a zero-filled buffer
let buffer = RasterBuffer::zeros(1000, 1000, RasterDataType::Float32);

// Create a buffer with nodata value
let nodata = NoDataValue::Float(-9999.0);
let buffer = RasterBuffer::nodata_filled(1000, 1000, RasterDataType::Float32, nodata);

§Working with pixel data

use oxigdal_core::buffer::RasterBuffer;
use oxigdal_core::types::RasterDataType;

let mut buffer = RasterBuffer::zeros(100, 100, RasterDataType::UInt8);

// Set pixel value
buffer.set_pixel(50, 50, 255.0)?;

// Get pixel value
let value = buffer.get_pixel(50, 50)?;
assert_eq!(value, 255.0);

§Computing statistics

use oxigdal_core::buffer::RasterBuffer;
use oxigdal_core::types::RasterDataType;

let buffer = RasterBuffer::zeros(1000, 1000, RasterDataType::Float32);
let stats = buffer.compute_statistics()?;

println!("Min: {}, Max: {}", stats.min, stats.max);
println!("Mean: {}, StdDev: {}", stats.mean, stats.std_dev);
println!("Valid pixels: {}", stats.valid_count);

§See Also

Structs§

BufferStatistics
Statistics computed from a buffer
RasterBuffer
A typed buffer for raster data