pub struct DatasetOpenBuilder { /* private fields */ }Expand description
Builder for opening an existing geospatial dataset with configurable options.
Uses the fluent / method-chaining pattern. Finalise with .open().
§Example
use oxigdal::builder::DatasetOpenBuilder;
let ds = DatasetOpenBuilder::new("world.tif")
.read_only(true)
.with_overview_level(1)
.with_tile_cache_mb(64)
.with_crs_override("EPSG:4326")
.open()?;Implementations§
Source§impl DatasetOpenBuilder
impl DatasetOpenBuilder
Sourcepub fn read_only(self, val: bool) -> Self
pub fn read_only(self, val: bool) -> Self
Set whether the dataset should be opened read-only (default: true).
When false the dataset is opened for read-write access. Not all
drivers support write access, and those that do not will return an error
from .open().
Sourcepub fn with_overview_level(self, level: u32) -> Self
pub fn with_overview_level(self, level: u32) -> Self
Request a specific overview / pyramid level (0 = native resolution).
Higher values access lower-resolution overviews, which is significantly faster for display and thumbnail generation.
Sourcepub fn with_tile_cache_mb(self, mb: u32) -> Self
pub fn with_tile_cache_mb(self, mb: u32) -> Self
Set the tile/block cache size in megabytes.
A larger cache reduces disk I/O when reading many tiles.
Sourcepub fn with_crs_override(self, wkt: impl Into<String>) -> Self
pub fn with_crs_override(self, wkt: impl Into<String>) -> Self
Override the CRS reported by the file.
wkt can be an EPSG code string ("EPSG:4326"), a WKT2 string, or a
PROJ definition string. This is useful when the file is missing CRS
metadata.
Sourcepub fn with_format_hint(self, format: DatasetFormat) -> Self
pub fn with_format_hint(self, format: DatasetFormat) -> Self
Provide a format hint to skip magic-byte detection.
Only needed for files with non-standard or missing extensions.
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Whether read-only mode is enabled.
Sourcepub fn overview_level(&self) -> Option<u32>
pub fn overview_level(&self) -> Option<u32>
Configured overview level, if any.
Sourcepub fn tile_cache_mb(&self) -> Option<u32>
pub fn tile_cache_mb(&self) -> Option<u32>
Configured tile cache size in MB, if any.
Sourcepub fn crs_override(&self) -> Option<&str>
pub fn crs_override(&self) -> Option<&str>
Configured CRS override string, if any.
Sourcepub fn open(self) -> Result<OpenedDataset>
pub fn open(self) -> Result<OpenedDataset>
Open the dataset with the configured options.
Internally calls open() for format detection, then applies the
configured options to the returned handle.
§Errors
Propagates any error from open(). Additionally returns
OxiGdalError::NotSupported if read_only = false is requested for
a format that is currently read-only.
Trait Implementations§
Source§impl Clone for DatasetOpenBuilder
impl Clone for DatasetOpenBuilder
Source§fn clone(&self) -> DatasetOpenBuilder
fn clone(&self) -> DatasetOpenBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more