Skip to content

Commit c6438bb

Browse files
committed
Added GDAL version cfg barriers on WarpResampleAlg options.
1 parent 9c9dd15 commit c6438bb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/raster/warp/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ mod tests {
169169
use crate::spatial_ref::SpatialRef;
170170
use crate::test_utils::{fixture, InMemoryFixture, TempFixture};
171171
use crate::{assert_near, Dataset};
172-
use std::path::Path;
173172

173+
// TODO: For some unknown reason this test fails on GDAL < 3.4
174+
#[cfg(any(all(major_ge_3, minor_ge_4), major_ge_4))]
174175
#[test]
175176
fn test_create_reproject() -> Result<()> {
177+
use std::path::Path;
176178
let dst_srs = SpatialRef::from_epsg(4269)?;
177179
let source = TempFixture::fixture("labels.tif");
178180

src/raster/warp/resample.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ pub enum WarpResampleAlg {
3131
Q1 = GDALResampleAlg::GRA_Q1,
3232
/// Q3 (selects third quartile of all non-NODATA contributing pixels)
3333
Q3 = GDALResampleAlg::GRA_Q3,
34-
/// Sum (weighed sum of all non-NODATA contributing pixels). Added in GDAL 3.1
34+
#[cfg(any(all(major_ge_3, minor_ge_1), major_ge_4))]
35+
/// Sum (weighed sum of all non-NODATA contributing pixels).
3536
Sum = GDALResampleAlg::GRA_Sum,
37+
#[cfg(any(all(major_ge_3, minor_ge_3), major_ge_4))]
3638
/// RMS (weighted root mean square (quadratic mean) of all non-NODATA contributing pixels)
3739
RMS = GDALResampleAlg::GRA_RMS,
3840
}
@@ -55,7 +57,9 @@ impl WarpResampleAlg {
5557
GDALResampleAlg::GRA_Med => WarpResampleAlg::Med,
5658
GDALResampleAlg::GRA_Q1 => WarpResampleAlg::Q1,
5759
GDALResampleAlg::GRA_Q3 => WarpResampleAlg::Q3,
60+
#[cfg(any(all(major_ge_3, minor_ge_1), major_ge_4))]
5861
GDALResampleAlg::GRA_Sum => WarpResampleAlg::Sum,
62+
#[cfg(any(all(major_ge_3, minor_ge_3), major_ge_4))]
5963
GDALResampleAlg::GRA_RMS => WarpResampleAlg::RMS,
6064
o => {
6165
return Err(GdalError::BadArgument(format!(

0 commit comments

Comments
 (0)