2

Whenever I add a resampling parameter (-r) to my gdal_translate commands, it seems to have no effect. For example the following two commands produce a binary exact result.

How can I get my image to have bilinear resampling? I am trying to smooth out my SRTM 4.1 (DEM) data.

GDAL 3.0.4

gdal_translate -of GTiff -r nearest D:/srtm_41_03.tif D:/bulgaria-nearest.tif

gdal_translate -of GTiff -r bilinear D:/srtm_41_03.tif D:/bulgaria-bilinear.tif

Source tile available here (srtm_41_03).

3
  • 2
    You are just re-writing the input file into the output file, so there's no need to do any resampling. For resampling to show up you'd need to e.g. change the resolution or the spatial extent of the data set.
    – Jose
    Commented Jun 14, 2020 at 19:38
  • @Jose What can I do to resample with bilinear? I actually want to combine 800 tiff files into one large tiff but I was trying to break this down to the minimum viable example to test resampling.
    – A. Mort
    Commented Jun 14, 2020 at 19:43
  • 1
    You should see difference by doing something that requires resampling, for example gdal_translate with -outsize 50% 50%.
    – user30184
    Commented Jun 14, 2020 at 20:32

1 Answer 1

4

Resampling applies when the gridding of the input file is different from the gridding in the new space (most of the time, a warped space due to reprojection). It also makes sense when the size of the grid changes. But when the size and shape of the grid remains constant there is no resampling.

If you want to smooth your DEM at a constant pixel size, you should look to use a smoothing filter. For example, the one that is available in Orfeo Toolbox: otbcli_Smoothing (can be installed for use in command line, or through Python, or from QGIS, or...). There is no bilinear smoothing option, but I would recommand you to use gaussian filtering in your case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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