[Gdal-dev] Resampling rasters with GDAL

Frank Warmerdam warmerdam at pobox.com
Sat Jul 8 14:29:44 EDT 2006


Jose Luis Gomez Dans wrote:
...
> What I want to do is to produce a new raster (derived from my original
> masks) that can be applied in a pixel-by-pixel basis, to the images.
> Usually, projection is not a problem (we always use the same), and
> resolution is no issue. However, the extent and required resampling (using
> nearest neighbour) is a problem. I have tried to use gdal_translate or
> gdalwarp, but it is not obvious to get the target's extent for the
> resampling (it is in meters, not pixels). With gdalwarp, there's the "-te"
> option, but it doesn't produce the results I want.

Jose,

Can you indicate in what regard -te doesn't do what you want?

> Also, in some cases, the images might have an extent which is larger than
> that of the masks. Apart from "cutting" the excess in the images, it would
> be nice to avoid this step, and to produce a resampled mask with all those
> pixels outside the original mask's extent set to NODATA. As I understand
> it, GDAL cannot do this.

If you use the -dstnodata flag with gdalwarp, and -te to set extents larger
than the source mask (to match your target image) it should be possible
to produce a ready to use result, with nodata set in the regions not available
from the source mask.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list