pub struct MmapTerrain<'a> { /* private fields */ }Expand description
Memory-mappable terrain reader backed by a terrain store byte span.
Scalar and batch terrain lookups return orthometric metres, H, above the
EGM96 mean sea level geoid. Use Self::ellipsoidal_height_m or
OrthometricHeightM::to_ellipsoidal_height_deg for the explicit
h = H + N conversion to WGS84 ellipsoidal height.
Implementations§
Source§impl MmapTerrain<'static>
impl MmapTerrain<'static>
Sourcepub fn from_vec(bytes: Vec<u8>) -> Result<Self, TerrainStoreError>
pub fn from_vec(bytes: Vec<u8>) -> Result<Self, TerrainStoreError>
Parse an owned terrain store byte vector.
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self, TerrainStoreError>
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, TerrainStoreError>
Read and parse a terrain store file.
This reads the file into memory. Applications that already manage an mmap
should pass the mmap slice to MmapTerrain::from_bytes to avoid the
file read copy.
Source§impl<'a> MmapTerrain<'a>
impl<'a> MmapTerrain<'a>
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self, TerrainStoreError>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, TerrainStoreError>
Parse a borrowed terrain store byte span.
The reader keeps the byte span in place and indexes posting payloads by offset. Passing an mmap-backed slice gives a zero-copy reader.
Sourcepub const fn vertical_datum(&self) -> VerticalDatum
pub const fn vertical_datum(&self) -> VerticalDatum
Return the store’s file-level vertical datum.
Sourcepub fn tile_index(&self) -> &[TerrainStoreTileIndex]
pub fn tile_index(&self) -> &[TerrainStoreTileIndex]
Borrow the parsed tile index records.
Sourcepub fn checksum64(&self) -> u64
pub fn checksum64(&self) -> u64
Return an FNV-1a checksum of the full terrain store byte span.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Re-serialize this parsed terrain store into canonical bytes.
A store accepted by Self::from_bytes is already canonical, so this
returns bytes identical to Self::as_bytes.
Sourcepub fn height_m(&mut self, longitude_deg: f64, latitude_deg: f64) -> Result<f64>
pub fn height_m(&mut self, longitude_deg: f64, latitude_deg: f64) -> Result<f64>
Return the bilinearly interpolated orthometric height H in metres at a
longitude-first geodetic position in degrees.
Sourcepub fn height_m_with_options(
&mut self,
longitude_deg: f64,
latitude_deg: f64,
options: DtedLookupOptions,
) -> Result<f64>
pub fn height_m_with_options( &mut self, longitude_deg: f64, latitude_deg: f64, options: DtedLookupOptions, ) -> Result<f64>
Return the orthometric height H in metres at a longitude-first geodetic
position in degrees using explicit lookup options.
Sourcepub fn orthometric_height_m(
&self,
longitude_deg: f64,
latitude_deg: f64,
) -> Result<OrthometricHeightM>
pub fn orthometric_height_m( &self, longitude_deg: f64, latitude_deg: f64, ) -> Result<OrthometricHeightM>
Return the bilinearly interpolated orthometric height H in metres as a
typed value at a longitude-first geodetic position in degrees.
Sourcepub fn orthometric_height_m_with_options(
&self,
longitude_deg: f64,
latitude_deg: f64,
options: DtedLookupOptions,
) -> Result<OrthometricHeightM>
pub fn orthometric_height_m_with_options( &self, longitude_deg: f64, latitude_deg: f64, options: DtedLookupOptions, ) -> Result<OrthometricHeightM>
Return the orthometric height H in metres as a typed value at a
longitude-first geodetic position in degrees using explicit lookup
options.
Sourcepub fn height_batch(
&mut self,
points: &[(f64, f64)],
options: DtedLookupOptions,
) -> Vec<Result<f64>> ⓘ
pub fn height_batch( &mut self, points: &[(f64, f64)], options: DtedLookupOptions, ) -> Vec<Result<f64>> ⓘ
Evaluate (longitude_deg, latitude_deg) points in order as orthometric
heights H in metres.
The tuple order is longitude-first, matching Self::height_m. Each
output element is independent, so an invalid point or parse failure is
returned only for that element.
Sourcepub fn orthometric_height_batch(
&self,
points: &[(f64, f64)],
options: DtedLookupOptions,
) -> Vec<Result<OrthometricHeightM>> ⓘ
pub fn orthometric_height_batch( &self, points: &[(f64, f64)], options: DtedLookupOptions, ) -> Vec<Result<OrthometricHeightM>> ⓘ
Evaluate (longitude_deg, latitude_deg) points in order as typed
orthometric heights H in metres.
The tuple order is longitude-first. Each output element is independent, so an invalid point or parse failure is returned only for that element.
Sourcepub fn ellipsoidal_height_m(
&self,
longitude_deg: f64,
latitude_deg: f64,
) -> Result<EllipsoidalHeightM, TerrainDatumError>
pub fn ellipsoidal_height_m( &self, longitude_deg: f64, latitude_deg: f64, ) -> Result<EllipsoidalHeightM, TerrainDatumError>
Return ellipsoidal height h in metres using the embedded EGM96
1-degree grid for h = H + N.
The input position is terrain order (longitude_deg, latitude_deg).
Internally, the geoid call is made with (latitude_deg, longitude_deg).
The embedded EGM96 1-degree grid agrees with the full EGM96
15-arcminute grid to about 0.4 m RMS.
Sourcepub fn ellipsoidal_height_m_with_options(
&self,
longitude_deg: f64,
latitude_deg: f64,
options: DtedLookupOptions,
) -> Result<EllipsoidalHeightM, TerrainDatumError>
pub fn ellipsoidal_height_m_with_options( &self, longitude_deg: f64, latitude_deg: f64, options: DtedLookupOptions, ) -> Result<EllipsoidalHeightM, TerrainDatumError>
Return ellipsoidal height h in metres using the embedded EGM96
1-degree grid for h = H + N and explicit terrain lookup options.
The input position is terrain order (longitude_deg, latitude_deg).
Internally, the geoid call is made with (latitude_deg, longitude_deg).
Sourcepub fn ellipsoidal_height_m_with_model(
&self,
longitude_deg: f64,
latitude_deg: f64,
options: DtedLookupOptions,
geoid: TerrainGeoidModel<'_>,
) -> Result<EllipsoidalHeightM, TerrainDatumError>
pub fn ellipsoidal_height_m_with_model( &self, longitude_deg: f64, latitude_deg: f64, options: DtedLookupOptions, geoid: TerrainGeoidModel<'_>, ) -> Result<EllipsoidalHeightM, TerrainDatumError>
Return ellipsoidal height h in metres using an explicit geoid tier for
h = H + N.
The input position is terrain order (longitude_deg, latitude_deg).
Internally, the geoid call is made with (latitude_deg, longitude_deg).
Choosing TerrainGeoidModel::Egm96FifteenMinute requires a loaded
WW15MGH.DAC grid and never falls back to the embedded EGM96 1-degree
grid.
Trait Implementations§
Source§impl<'a> Clone for MmapTerrain<'a>
impl<'a> Clone for MmapTerrain<'a>
Source§fn clone(&self) -> MmapTerrain<'a>
fn clone(&self) -> MmapTerrain<'a>
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<'a> Freeze for MmapTerrain<'a>
impl<'a> RefUnwindSafe for MmapTerrain<'a>
impl<'a> Send for MmapTerrain<'a>
impl<'a> Sync for MmapTerrain<'a>
impl<'a> Unpin for MmapTerrain<'a>
impl<'a> UnsafeUnpin for MmapTerrain<'a>
impl<'a> UnwindSafe for MmapTerrain<'a>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.