[gdal-dev] Call for discussion on RFC 51: RasterIO() improvements : resampling and progress callback

Even Rouault even.rouault at spatialys.com
Tue Nov 25 02:47:20 PST 2014


Mike,

The gaussian resampling is the one already available for gdaladdo, that was 
added per
http://trac.osgeo.org/gdal/ticket/2137
and
http://trac.osgeo.org/gdal/changeset/15323

Basically :
- for a downscaling of factor between 1 and 2 (and for upscaling as well), it 
will use a 3x3 kernel
- for a downscaling of factor between 2 and 4, it will use a 5x5 kernel
- beyond it will use a 7x7 kernel.

I understand that gaussian blur can/could be parametrized in more complex 
ways. If there are improvements in that area, additional parameters could 
likely be passed through the GDALRasterIOExtraArg structure.

I've also wondered if the resampling algorithm couldn't be specified as a 
string instead of an enumerated value. In which case you could have had things 
like "gauss_x_y" with x and y as parameters. I don't have strong preference 
for one way or the other one. And both already exist in GDAL : the GDAL 
warping API uses an enumerated value, the GDAL overview API uses a string...

Even

> On 25 November 2014 at 05:34, Even Rouault <even.rouault at spatialys.com> 
wrote:
> >> Otherwise I have not much to say about this RFC. "Blurring" has two r's,
> > 
> > Fixed
> 
> Gaussian blur also has another complexity, since it's output
> dimensions depend on the fftconvolve mode (using scipy.signal docs
> http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.fft
> convolve.html).
> 
> For example, to "blur" a DTM and maintain the same output dimensions
> and geotransform, the mode would need to use a 'valid' convolution
> with a padded input array. This padded array would also have a mode
> (similarly from numpy docs
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.pad.html),
> such as 'symmetric'.
> http://gis.stackexchange.com/a/10467/1872
> 
> Someone else may want to blur a DTM without using a padded array, and
> just return a smaller array with modified geotransform.
> 
> And a different "blur" would expand the output dimension and modify
> the geotransform using a 'full' fftconvolve mode, using a 'constant'=0
> padded array. An example of this is to "blur" a polygon that barely
> extends to the shape's extent, but maintain the blur beyond the
> initial extent. The constant value would also need to be supplied, as
> a value of 0 for numpy is default.
> http://gis.stackexchange.com/a/104338/1872
> 
> So in summary, I'm not sure how GDAL could best cover all combinations
> of padding and convolution modes, except to offer a few prepared
> use-cases, or somehow provide extra parameters. Or just provide a
> single use case, similar to Gaussian blur routines in various raster
> editing software.
> 
> -Mike

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list