1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
//! OxiGDAL VRT Driver - Pure Rust VRT (Virtual Raster) Support
//!
//! This crate provides a pure Rust implementation of GDAL's VRT (Virtual Raster)
//! format, enabling efficient multi-file processing and on-the-fly transformations.
//!
//! # VRT Format
//!
//! VRT (Virtual Raster) is an XML-based format that references other raster files
//! without copying data. This enables:
//!
//! - **Mosaicking**: Combine multiple tiles into a single virtual dataset
//! - **Subsetting**: Extract specific bands from multi-band rasters
//! - **Transformation**: Apply on-the-fly scaling, offset, and pixel functions
//! - **Windowing**: Create virtual subsets of large rasters
//!
//! # Features
//!
//! - `std` (default) - Enable standard library support
//! - `async` - Enable async I/O support
//!
//! # Examples
//!
//! ## Create a Simple VRT Mosaic
//!
//! ```rust,no_run
//! use oxigdal_vrt::VrtBuilder;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let vrt = VrtBuilder::new()
//! .add_tile("/data/tile1.tif", 0, 0, 512, 512)?
//! .add_tile("/data/tile2.tif", 512, 0, 512, 512)?
//! .add_tile("/data/tile3.tif", 0, 512, 512, 512)?
//! .add_tile("/data/tile4.tif", 512, 512, 512, 512)?
//! .build_file("mosaic.vrt")?;
//!
//! println!("Created VRT: {}x{}", vrt.raster_x_size, vrt.raster_y_size);
//! # Ok(())
//! # }
//! ```
//!
//! ## Read from a VRT
//!
//! ```rust,no_run
//! use oxigdal_vrt::VrtReader;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let reader = VrtReader::open("mosaic.vrt")?;
//! println!("VRT dimensions: {}x{}", reader.width(), reader.height());
//! println!("Bands: {}", reader.band_count());
//!
//! // Read a band (lazy evaluation - only reads from source files as needed)
//! let band_data = reader.read_band(1)?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Create a Multi-Band VRT
//!
//! ```rust,no_run
//! use oxigdal_vrt::{VrtBuilder, VrtBand, VrtSource, SourceFilename};
//! use oxigdal_core::types::RasterDataType;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut builder = VrtBuilder::with_size(1024, 1024);
//!
//! // Band 1: Red
//! let red_source = VrtSource::new(SourceFilename::absolute("/data/red.tif"), 1);
//! let red_band = VrtBand::simple(1, RasterDataType::UInt8, red_source);
//! builder = builder.add_band(red_band)?;
//!
//! // Band 2: Green
//! let green_source = VrtSource::new(SourceFilename::absolute("/data/green.tif"), 1);
//! let green_band = VrtBand::simple(2, RasterDataType::UInt8, green_source);
//! builder = builder.add_band(green_band)?;
//!
//! // Band 3: Blue
//! let blue_source = VrtSource::new(SourceFilename::absolute("/data/blue.tif"), 1);
//! let blue_band = VrtBand::simple(3, RasterDataType::UInt8, blue_source);
//! builder = builder.add_band(blue_band)?;
//!
//! let vrt = builder.build_file("rgb.vrt")?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Use Mosaic Builder for Grid Layout
//!
//! ```rust,no_run
//! use oxigdal_vrt::MosaicBuilder;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mosaic = MosaicBuilder::new(256, 256)
//! .add_tile("/tile_0_0.tif")?
//! .next_column()
//! .add_tile("/tile_1_0.tif")?
//! .next_row()
//! .add_tile("/tile_0_1.tif")?
//! .next_column()
//! .add_tile("/tile_1_1.tif")?
//! .with_srs("EPSG:4326")
//! .build_file("grid.vrt")?;
//! # Ok(())
//! # }
//! ```
//!
//! # Architecture
//!
//! The VRT driver is organized into several modules:
//!
//! - [`error`] - Error types for VRT operations
//! - [`source`] - Source raster references and windowing
//! - [`band`] - Virtual band configuration
//! - [`dataset`] - VRT dataset definition
//! - [`xml`] - XML parser and writer
//! - [`builder`] - Fluent builder API
//! - [`reader`] - Lazy reader with caching
//! - [`mosaic`] - Mosaicking and compositing logic
// Pedantic disabled to reduce noise - default clippy::all is sufficient
// #![warn(clippy::pedantic)]
// Re-export commonly used types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Checks if data looks like a VRT file
///
/// # Examples
///
/// ```
/// use oxigdal_vrt::is_vrt;
///
/// let vrt_data = b"<VRTDataset rasterXSize=\"512\" rasterYSize=\"512\">";
/// assert!(is_vrt(vrt_data));
///
/// let not_vrt = b"GIF89a";
/// assert!(!is_vrt(not_vrt));
/// ```
/// VRT driver version
pub const VERSION: &str = env!;
/// VRT driver name
pub const DRIVER_NAME: &str = "VRT";
/// VRT driver description
pub const DRIVER_DESCRIPTION: &str = "Virtual Raster";