More

How to resample a batch of rasters using OGR/GDAL?

How to resample a batch of rasters using OGR/GDAL?


I'm looking for a function similar to GRASS r.resample. I have a folder full of TIF files and want to reduce their resolution ("scale them down") to reduce file size.


Your best bet would appear to be gdalwarp, which is documented over here. It's trivially easily scriptable, but the details would depend on your operating system. In Windows, you'd do something like:

for %i in (*.tif) do gdalwarp -ts 1600 0 -r cubic -co "TFW=YES" %i %~ni_small.tif

which should reduce the input files to 1600 pixels wide, saving the file with the original name appended with "small". This is seriously untested, ymmv. Besides, you're probably using Linux - if so, post back, and someone can help there. Ditto if you're looking for a Python solution.

Edited: added parameter to create ESRI world file. Note that this solution doesn't specify the output format, so it's a GeoTiff by default


Watch the video: Install GDAL on Windows. burdGIS