Skip to main content

VrtDataset

Struct VrtDataset 

Source
pub struct VrtDataset {
    pub raster_x_size: u64,
    pub raster_y_size: u64,
    pub geo_transform: Option<GeoTransform>,
    pub srs: Option<String>,
    pub bands: Vec<VrtBand>,
    pub block_size: Option<(u32, u32)>,
    pub subclass: Option<VrtSubclass>,
    pub vrt_path: Option<PathBuf>,
}
Expand description

VRT dataset

Fields§

§raster_x_size: u64

Raster width in pixels

§raster_y_size: u64

Raster height in pixels

§geo_transform: Option<GeoTransform>

GeoTransform (affine transform for georeferencing)

§srs: Option<String>

Spatial reference system (WKT or PROJ.4 string)

§bands: Vec<VrtBand>

Bands

§block_size: Option<(u32, u32)>

Block size (default tile dimensions)

§subclass: Option<VrtSubclass>

Subclass (for special VRT types)

§vrt_path: Option<PathBuf>

VRT file path (for resolving relative paths)

Implementations§

Source§

impl VrtDataset

Source

pub fn new(raster_x_size: u64, raster_y_size: u64) -> Self

Creates a new VRT dataset

Source

pub fn from_bands(bands: Vec<VrtBand>) -> Result<Self>

Creates a new VRT dataset with extent from sources

§Errors

Returns an error if no bands are provided

Source

pub fn add_band(&mut self, band: VrtBand)

Adds a band to the dataset

Source

pub fn with_geo_transform(self, geo_transform: GeoTransform) -> Self

Sets the GeoTransform

Source

pub fn with_srs<S: Into<String>>(self, srs: S) -> Self

Sets the spatial reference system

Source

pub fn with_block_size(self, width: u32, height: u32) -> Self

Sets the block size

Source

pub fn with_subclass(self, subclass: VrtSubclass) -> Self

Sets the subclass

Source

pub fn with_vrt_path<P: Into<PathBuf>>(self, path: P) -> Self

Sets the VRT file path

Source

pub fn validate(&self) -> Result<()>

Validates the dataset

§Errors

Returns an error if the dataset is invalid

Source

pub fn band_count(&self) -> usize

Gets the number of bands

Source

pub fn get_band(&self, index: usize) -> Option<&VrtBand>

Gets a band by index (0-based)

Source

pub fn get_band_mut(&mut self, index: usize) -> Option<&mut VrtBand>

Gets a mutable reference to a band by index (0-based)

Source

pub fn extent(&self) -> PixelRect

Gets the extent as a pixel rectangle

Source

pub fn effective_block_size(&self) -> (u32, u32)

Gets the effective block size (uses dataset default or falls back to 256x256)

Source

pub fn merge_geo_transforms(&mut self) -> Result<()>

Merges GeoTransforms from multiple sources to create a unified transform

§Errors

Returns an error if sources have incompatible GeoTransforms

Source

pub fn primary_data_type(&self) -> Option<RasterDataType>

Gets the data type of the first band

Source

pub fn has_uniform_data_type(&self) -> bool

Checks if all bands have the same data type

Trait Implementations§

Source§

impl Clone for VrtDataset

Source§

fn clone(&self) -> VrtDataset

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VrtDataset

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for VrtDataset

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for VrtDataset

Source§

fn eq(&self, other: &VrtDataset) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for VrtDataset

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for VrtDataset

Auto Trait Implementations§

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
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,