pub struct DemRaster {
pub bbox: BoundingBox,
pub cols: usize,
pub rows: usize,
pub data: Vec<f32>,
pub nodata: f32,
}Expand description
A raster grid of elevation values covering a bounding box.
Fields§
§bbox: BoundingBoxGeographic extent of the raster.
cols: usizeNumber of columns.
rows: usizeNumber of rows.
data: Vec<f32>Row-major elevation samples [m]. Length = rows × cols.
nodata: f32No-data sentinel value.
Implementations§
Source§impl DemRaster
impl DemRaster
Sourcepub fn zeros(bbox: BoundingBox, cols: usize, rows: usize) -> Self
pub fn zeros(bbox: BoundingBox, cols: usize, rows: usize) -> Self
Construct a zero-filled DEM raster.
Sourcepub fn cell_width_deg(&self) -> f64
pub fn cell_width_deg(&self) -> f64
Cell width in degrees.
Sourcepub fn cell_height_deg(&self) -> f64
pub fn cell_height_deg(&self) -> f64
Cell height in degrees.
Sourcepub fn sample(&self, pt: LonLat) -> Option<f32>
pub fn sample(&self, pt: LonLat) -> Option<f32>
Sample elevation at a geographic position using bilinear interpolation.
Returns None if pt is outside the raster extent or resolves to a
no-data cell.
Sourcepub fn min_elevation(&self) -> Option<f32>
pub fn min_elevation(&self) -> Option<f32>
Return the minimum elevation, ignoring no-data values.
Sourcepub fn max_elevation(&self) -> Option<f32>
pub fn max_elevation(&self) -> Option<f32>
Return the maximum elevation, ignoring no-data values.
Sourcepub fn to_ascii_grid(&self) -> String
pub fn to_ascii_grid(&self) -> String
Export to an ASCII Grid string (ESRI format).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DemRaster
impl RefUnwindSafe for DemRaster
impl Send for DemRaster
impl Sync for DemRaster
impl Unpin for DemRaster
impl UnsafeUnpin for DemRaster
impl UnwindSafe for DemRaster
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.