Uses the tiff crate for the I/O, ndarray crate to store the 2D array in Rust, and numpy crate to convert to numpy.ndarray in Python.
Note: This only works on single-band GeoTIFF files with float32 dtype for now
Usage:
In Rust:
use ndarray::Array2;
use std::fs::File;
use cog3pio::io::geotiff::read_geotiff;
let path: &str = "path/to/file.tif";
let file: File = File::open(path).expect("Cannot find GeoTIFF file");
let arr: Array2<f32> = read_geotiff(file).unwrap();
assert_eq!(arr.dim(), (20, 20));
assert_eq!(arr.mean(), Some(19.0));
Rust-based function for reading GeoTIFF files!
Uses the
tiff
crate for the I/O,ndarray
crate to store the 2D array in Rust, andnumpy
crate to convert to numpy.ndarray in Python.Note: This only works on single-band GeoTIFF files with float32 dtype for now
Usage:
In Rust:
In Python:
TODO:
TODO in future:
References: