pub struct CogReader {
pub metadata: CogMetadata,
pub overviews: Vec<OverviewMetadata>,
pub min_usable_overview: Option<usize>,
/* private fields */
}Expand description
COG Reader - efficient COG access with range requests
Fields§
§metadata: CogMetadata§overviews: Vec<OverviewMetadata>Overview levels (sorted by scale factor, smallest to largest)
min_usable_overview: Option<usize>Minimum usable overview index - overviews beyond this have insufficient data None means all overviews are usable, Some(n) means only overviews 0..n are usable
Implementations§
Source§impl CogReader
impl CogReader
Sourcepub fn open(source: &str) -> AnyResult<Self>
pub fn open(source: &str) -> AnyResult<Self>
Open a COG from any source (local file, HTTP URL, or S3)
Sourcepub fn from_reader(reader: Arc<dyn RangeReader>) -> AnyResult<Self>
pub fn from_reader(reader: Arc<dyn RangeReader>) -> AnyResult<Self>
Open from an existing range reader
Sourcepub fn best_overview_for_resolution(
&self,
extent_src_width: usize,
extent_src_height: usize,
) -> Option<usize>
pub fn best_overview_for_resolution( &self, extent_src_width: usize, extent_src_height: usize, ) -> Option<usize>
Find the best overview level for a given source extent size
Parameters:
extent_src_width: How many source pixels the extent covers at full resolutionextent_src_height: How many source pixels the extent covers at full resolutionoutput_width: How many pixels we’re actually rendering (e.g., 256)output_height: How many pixels we’re actually rendering (e.g., 256)
Returns None if full resolution should be used
Sourcepub fn read_overview_tile(
&self,
overview_idx: usize,
tile_index: usize,
) -> AnyResult<Vec<f32>>
pub fn read_overview_tile( &self, overview_idx: usize, tile_index: usize, ) -> AnyResult<Vec<f32>>
Read a tile from a specific overview level
Sourcepub fn read_tile(&self, tile_index: usize) -> AnyResult<Vec<f32>>
pub fn read_tile(&self, tile_index: usize) -> AnyResult<Vec<f32>>
Read a single tile’s raw data and decompress
Sourcepub fn sample(&self, band: usize, x: usize, y: usize) -> AnyResult<Option<f32>>
pub fn sample(&self, band: usize, x: usize, y: usize) -> AnyResult<Option<f32>>
Sample a single pixel value
Sourcepub fn estimate_min_max(&self) -> AnyResult<(f32, f32)>
pub fn estimate_min_max(&self) -> AnyResult<(f32, f32)>
Estimate min/max from sampling (when GDAL stats not available)
For local files: Scans ALL tiles for accurate min/max values For remote files (S3/HTTP): Samples a few tiles for efficiency
Use estimate_min_max_fast() to always use fast sampling regardless of source.
Sourcepub fn estimate_min_max_fast(&self) -> AnyResult<(f32, f32)>
pub fn estimate_min_max_fast(&self) -> AnyResult<(f32, f32)>
Fast min/max estimation - samples only corner and center tiles Use this for remote files where full scans are expensive
Auto Trait Implementations§
impl Freeze for CogReader
impl !RefUnwindSafe for CogReader
impl Send for CogReader
impl Sync for CogReader
impl Unpin for CogReader
impl !UnwindSafe for CogReader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more