Skip to main content

ElevationRaster

Struct ElevationRaster 

Source
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>

Source

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.

Source

pub fn info(&self) -> &RasterInfo

What the file says about itself.

Source

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.

Source

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

As ElevationRaster::height_at.

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> ElevationRaster<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ElevationRaster<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ElevationRaster<'a>

§

impl<'a> RefUnwindSafe for ElevationRaster<'a>

§

impl<'a> Send for ElevationRaster<'a>

§

impl<'a> Sync for ElevationRaster<'a>

§

impl<'a> Unpin for ElevationRaster<'a>

§

impl<'a> UnsafeUnpin for ElevationRaster<'a>

§

impl<'a> UnwindSafe for ElevationRaster<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.