pub struct GeoTiffReader {
pub width: usize,
pub height: usize,
pub bands: usize,
pub transform: [f64; 6],
/* private fields */
}Expand description
A minimal GeoTIFF-style raster reader that holds image geometry and georeferencing metadata.
The affine transform follows the standard 6-parameter GDAL convention:
[x_origin, pixel_width, row_rotation, y_origin, col_rotation, pixel_height]
where pixel_height is typically negative (top-left origin).
Fields§
§width: usizeRaster width in pixels.
height: usizeRaster height in pixels.
bands: usizeNumber of spectral or data bands.
transform: [f64; 6]Six-element affine geotransform (GDAL order).
Implementations§
Source§impl GeoTiffReader
impl GeoTiffReader
Sourcepub fn new(
width: usize,
height: usize,
bands: usize,
transform: [f64; 6],
data: Vec<Vec<f64>>,
) -> Self
pub fn new( width: usize, height: usize, bands: usize, transform: [f64; 6], data: Vec<Vec<f64>>, ) -> Self
Construct a new GeoTiffReader with explicit dimensions and transform.
Sourcepub fn pixel_to_world(&self, px: usize, py: usize) -> [f64; 2]
pub fn pixel_to_world(&self, px: usize, py: usize) -> [f64; 2]
Convert pixel coordinates (px, py) to world (lon, lat) coordinates
using the stored affine transform.
Sourcepub fn world_to_pixel(&self, lon: f64, lat: f64) -> (usize, usize)
pub fn world_to_pixel(&self, lon: f64, lat: f64) -> (usize, usize)
Convert world (lon, lat) coordinates to pixel coordinates using the inverse of the stored affine transform.
Sourcepub fn read_band(&self, band: usize) -> Vec<f64>
pub fn read_band(&self, band: usize) -> Vec<f64>
Return a clone of band band data (0-indexed).
Returns an empty vector if band >= self.bands.
Sourcepub fn elevation_at(&self, lon: f64, lat: f64) -> f64
pub fn elevation_at(&self, lon: f64, lat: f64) -> f64
Return the elevation (first-band value) at world coordinate (lon, lat).
Sourcepub fn bounding_box(&self) -> [f64; 4]
pub fn bounding_box(&self) -> [f64; 4]
Return the bounding box [min_lon, min_lat, max_lon, max_lat].
Trait Implementations§
Source§impl Clone for GeoTiffReader
impl Clone for GeoTiffReader
Source§fn clone(&self) -> GeoTiffReader
fn clone(&self) -> GeoTiffReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GeoTiffReader
impl RefUnwindSafe for GeoTiffReader
impl Send for GeoTiffReader
impl Sync for GeoTiffReader
impl Unpin for GeoTiffReader
impl UnsafeUnpin for GeoTiffReader
impl UnwindSafe for GeoTiffReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.