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

Re-exports§

pub use mask::Mask;
pub use crate::simd_buffer::ArenaTile;
pub use crate::simd_buffer::TileIteratorArena;

Modules§

mask
Nodata and validity bitmask for raster regions.

Structs§

BandIterator
Lazy iterator over bands of a MultiBandBuffer.
BandRef
A borrowed reference to a single band within a MultiBandBuffer.
BufferStatistics
Statistics computed from a buffer
MultiBandBuffer
A multi-band raster buffer holding multiple single-band buffers.
RasterBuffer
A typed buffer for raster data
RasterWindow
A sub-region window into a raster dataset. Defines a rectangular area for reading/writing a portion of raster data.