Skip to content

Commit

Permalink
Added GDAL version cfg barriers on WarpResampleAlg options.
Browse files Browse the repository at this point in the history
  • Loading branch information
metasim committed Dec 29, 2023
1 parent 9c9dd15 commit 9e9ba71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/raster/warp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ mod tests {
use crate::{assert_near, Dataset};
use std::path::Path;

// TODO: For some unknown reason this test fails on GDAL < 3.4
#[cfg(any(all(major_ge_3, minor_ge_4), major_ge_4))]
#[test]
fn test_create_reproject() -> Result<()> {
let dst_srs = SpatialRef::from_epsg(4269)?;
Expand Down
6 changes: 5 additions & 1 deletion src/raster/warp/resample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ pub enum WarpResampleAlg {
Q1 = GDALResampleAlg::GRA_Q1,
/// Q3 (selects third quartile of all non-NODATA contributing pixels)
Q3 = GDALResampleAlg::GRA_Q3,
/// Sum (weighed sum of all non-NODATA contributing pixels). Added in GDAL 3.1
#[cfg(any(all(major_ge_3, minor_ge_1), major_ge_4))]
/// Sum (weighed sum of all non-NODATA contributing pixels).
Sum = GDALResampleAlg::GRA_Sum,
#[cfg(any(all(major_ge_3, minor_ge_3), major_ge_4))]
/// RMS (weighted root mean square (quadratic mean) of all non-NODATA contributing pixels)
RMS = GDALResampleAlg::GRA_RMS,
}
Expand All @@ -55,7 +57,9 @@ impl WarpResampleAlg {
GDALResampleAlg::GRA_Med => WarpResampleAlg::Med,
GDALResampleAlg::GRA_Q1 => WarpResampleAlg::Q1,
GDALResampleAlg::GRA_Q3 => WarpResampleAlg::Q3,
#[cfg(any(all(major_ge_3, minor_ge_1), major_ge_4))]
GDALResampleAlg::GRA_Sum => WarpResampleAlg::Sum,
#[cfg(any(all(major_ge_3, minor_ge_3), major_ge_4))]
GDALResampleAlg::GRA_RMS => WarpResampleAlg::RMS,
o => {
return Err(GdalError::BadArgument(format!(
Expand Down

0 comments on commit 9e9ba71

Please sign in to comment.