pub struct ElevationRaster<'a> { /* private fields */ }Expand description
A GeoTIFF elevation file, its tags read and its pixels left packed in the borrowed bytes.
Implementations§
Source§impl<'a> ElevationRaster<'a>
impl<'a> ElevationRaster<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, GeoTiffError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, GeoTiffError>
Reads a GeoTIFF’s tags: its size, sample type, layout, georeferencing, scale, units and nodata value.
§Errors
GeoTiffError if the TIFF is unreadable, its georeferencing is missing, malformed or
one the module docs list as refused, its CRS is not one of NEAR_WGS84 in degrees, its
pixels are not one band of a SampleType in a codec it reads, or a tile is larger than
MAX_CHUNK_BYTES.
Sourcepub fn info(&self) -> &RasterInfo
pub fn info(&self) -> &RasterInfo
What the file says about itself.
Sourcepub fn height_at(
&self,
latitude_deg: f64,
longitude_deg: f64,
) -> Result<Option<f64>, GeoTiffError>
pub fn height_at( &self, latitude_deg: f64, longitude_deg: f64, ) -> Result<Option<f64>, GeoTiffError>
The ground’s height at a site, meters above the file’s vertical datum: the value of the
pixel holding the point (RasterInfo::pixel_of) through RasterInfo::meters. None
where that pixel is nodata.
§Errors
GeoTiffError::Location for a latitude outside ±90° or a longitude that is not finite,
GeoTiffError::Outside off the raster, and GeoTiffError::Tiff if the pixel’s tile
will not decode.
Sourcepub fn value_at(
&self,
latitude_deg: f64,
longitude_deg: f64,
) -> Result<Option<f64>, GeoTiffError>
pub fn value_at( &self, latitude_deg: f64, longitude_deg: f64, ) -> Result<Option<f64>, GeoTiffError>
The raw value of the pixel holding a point, before the scale, offset and unit; None
where it is nodata. This is the value GDAL reads at the point.
§Errors
Sourcepub fn pixel(&self, pixel: Pixel) -> Result<Option<f64>, GeoTiffError>
pub fn pixel(&self, pixel: Pixel) -> Result<Option<f64>, GeoTiffError>
The raw value of a pixel, decoding only its tile or strip; None where it is nodata.
§Errors
GeoTiffError::NoSuchPixel for a pixel off the raster, GeoTiffError::Tiff if its
tile will not decode.
Sourcepub fn values_at(
&self,
points: &[(f64, f64)],
) -> Vec<Result<Option<f64>, GeoTiffError>>
pub fn values_at( &self, points: &[(f64, f64)], ) -> Vec<Result<Option<f64>, GeoTiffError>>
The raw values at several points, decoding each tile or strip they fall in once: what
ElevationRaster::value_at gives for each, in order, its error included. A tile that
will not decode fails only the points in it.
Sourcepub fn values(&self) -> Result<Vec<f64>, GeoTiffError>
pub fn values(&self) -> Result<Vec<f64>, GeoTiffError>
Every pixel’s raw value, row by row from the first; NaN where it is nodata. Each tile or strip is decoded once.
§Errors
GeoTiffError::TooLarge past MAX_VALUES_PIXELS or when the memory can’t be had,
GeoTiffError::Tiff if a tile will not decode.
Trait Implementations§
Source§impl<'a> Clone for ElevationRaster<'a>
impl<'a> Clone for ElevationRaster<'a>
Source§fn clone(&self) -> ElevationRaster<'a>
fn clone(&self) -> ElevationRaster<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more