[gdal-dev] downsampling geotiff with a low-pass filter

Markus Neteler neteler at osgeo.org
Fri Nov 16 08:04:12 PST 2018


On Fri, Nov 16, 2018 at 4:38 PM JDA <jacob.dan.adams at gmail.com> wrote:
>
>
> It's better to use a sensible smoothing method in the first place. I
> suppose noone has given this over much thought as in the past you were
> ever so happy about every bit of resolution you could get. But in a time
> where we get very high resolution LIDAR data, the need to downsample
> properly is arising. Look at the interpolation methods: gdalwarp lists
> twelve different ones. The first few are for upsampling, and the
> remainder mostly for dealing with noisy data. Upsampling is well
> covered: cubicspline and lanczos are reasonably sophisticated upsampling
> filters, but there is no good downsampling filter. I think this is an
> omission, hence my post. The problem is real; downsampling with
> 'average' produces artifacts, even from previously upsampled data.
>
>
> There’s a wide array of smoothing options available If you’re willing to work in python. Based on https://gis.stackexchange.com/a/10467, the basic idea is to load the raster into a numpy array and then convolve it with either a kernel of arbitrary size.

There are plenty of different kernel smoothers in GRASS GIS, e.g.

box, bartlett, gauss, normal, hermite, sinc, lanczos1, lanczos2,
lanczos3, hann, hamming, blackman
https://grass.osgeo.org/grass76/manuals/r.resamp.filter.html

Using "grass-session" (https://github.com/zarch/grass-session) you can
use the functionality in Python also from "outside" without even
knowing much about GRASS GIS itself.

Markus


More information about the gdal-dev mailing list