[gdal-dev] Downsample with averaging?

Brian Claywell bcclaywell at gmail.com
Tue Feb 22 00:27:47 EST 2011


On Mon, Feb 21, 2011 at 2:26 PM, Jay Jennings <Jennings.Jay at geoeye.com> wrote:
> [...] I’m looking for a
> downsampling scheme that creates a result pixel by averaging all relevant
> source pixels (I know, for 32:1 downsample, that means 1024 source pixels
> for each result pixel !) with the hope of an output that is not “speckled”
> or “grainy” insofar as possible.

gdalwarp would probably give you the most control over the resampling
algorithm: http://www.gdal.org/gdalwarp.html
Look particularly at the -tr (target resolution, in georeferenced
units) or -ts (target size, in pixels) options.

For example, to produce a 32:1 thumbnail of a 44418x39108 GeoTIFF that
I have laying around,

$ gdalwarp -ts 1389 1223 -r bilinear input.tif output.tif

You can experiment with the different resampling algorithms to find
one you like (near, bilinear, cubic, cubicspline, lanczos).

> gdaladdo  -r  average  -ro  XXXXX.tif  32
>
> But that produces a surprising error message, namely:
>
> ERROR 4: `XXXXX.tif.ovr' does not exist in the file system, and is not
> recognised as a supported dataset name.

I tried gdaladdo with your arguments on the GeoTIFF I mentioned above
(which is 3.4 GB) and it executed with no problems. Your error sounds
like the *.tif.ovr file simply didn't get created; you might
double-check that you have write permissions in the directory where
your input file lives. I believe overviews are always written into the
same directory as their source file, rather than your current working
directory.

-b

-- 
Brian Claywell
bcclaywell at gmail.com


More information about the gdal-dev mailing list