2

I observe a regular pattern of flat pixel bands on a DEM reprojected using gdalwarp:

Flat pixels bands

The red line represents a profile for which the following graph is an extract between the two squared dots, so it crosses two flat pixel bands that are clearly visible:

2 of the flat bands on the profile

I simply reprojected an original WGS84 DEM to the UTM of the region with:

$ gdalwarp -t_srs EPSG:23032 input_dem.tif reprojected.tif;

The green line is the profile of the original WGS84 DEM, it's super smooth and it doesn't show the flat pixels pattern.

Is this a known issue? And what could I do to avoid this pattern?

Info:

The version of GDAL I use is from this Docker image ubuntu-small-latest available at https://hub.docker.com/r/osgeo/gdal

# gdalinfo --version
GDAL 3.3.0dev-33cf0e31a992be112b3091f012368d15605ed51d, released 2021/03/17
1
  • 2
    You're using the default nearest neighbour resampling method. Suggest you use a different resampling method. From the doc "-r <resampling_method> Resampling method to use. near: nearest neighbour resampling (default, fastest algorithm, worst interpolation quality)."
    – user2856
    Mar 20, 2021 at 22:15

1 Answer 1

1

I went through a lot of posts to figure out that, indeed, using the nearest neighbor interpolation method, in the case of a continuous raster such as a DEM, is not really a good idea. And that there is a mix between a "divinatory art" and an accumulated knowledge when it comes to applying filters.

In my case, the resulting re-projected raster is suffering some aliasing effects. I cannot explain why the repetitive pattern spacing is ~80 meters, which is not really 'near' (as in 'nearest neighbor'). And when I look closer (well, actually further), there is actually another pattern, oriented differently, with a much greater wavelength of roughly 650m.

Anyway, here are some great posts and answers out there that are worth reading imho:

Deciding what interpolation method to use for resampling raster data?

What resampling technique should be used when projecting aerial photos?

Pros and Cons of using Bilinear Interpolation and Cubic Convolution when dealing with DEMs?

Best Resampling Method for DEM reprojection in QGis

What resampling technique should be used to reproject an altitude raster?

What is the source of horizontal and vertical striping in USGS DEMs?

Why do "stripes" appear on raster?

What is Lanczos resampling useful for in a spatial context?

Based on all these, I randomly decided to chose the bilinear interpolation when reprojecting my raster DEM. I was hesitating with the cubic or cubicspline offered by the -r flag of gdalwarp as they also seem to be nice candidates. I also wanted to test the gaussian filter, but it doesn't seem to be available with gdalwarp.

The Lanczos method also looks great, but I prefer to avoid it when dealing with DEMs in order to not create altitudes that will extend out of the min-max range of the original DEM.

Here is a new line in blue, smoother and closer to the original DEM profile (green), representing the output result using the bilinear interpolation when re-projecting the DEM:

Bilinear result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.