[gdal-dev] merge with gdalwrap

Frank Warmerdam warmerdam at pobox.com
Thu Jul 30 14:19:07 EDT 2009

Steve.Toutant at inspq.qc.ca wrote:
> Hi,
> I tried gdal_merge.py but I got a memory Error because I use the -n 
> nodata value option. Several threads sugest that I must use gdalwrap 
> instead.
> This behavior of gdal_merge.py is very important to me in this 
> particular case
> "In areas of overlap, the last image will be copied over earlier ones".
> Does gdalwrap has the same behavior? (I ask because it is difficult to 
> test and validate with my data)?


Yes, gdalwarp will overlay valid new data over existing data with the
last gdalwarp overlaying previous data.

> Also, the doc says "Mosaicing into an existing output file is supported 
> if the output file already exists."
> But how? What is the option to append data? When launching a command for 
> another image it says that I must delete the output file.

If you pass an output file to gdalwarp and it already exists then it
will be mosaiced into.  If the output file does not already exist
then one is created.  This is different than gdal_translate which
always creates a new file.

> I would appreciate if someone could validate if this
> gdalwarp -srcnodata -3.4028234663852886e+38 -dstnodata 
> -3.4028234663852886e+38 -of "GTiff" EstRN.img icu.tif
> is the equivalent of this
> gdal_merge.py -n -3.4028234663852886e+38 -o icu.tif -of "GTiff" 
> EstRN.img EstSh.img

Well, it doesn't mention EstSH.img - so no it does not seem
to be the same thing.  If you did:

gdalwarp -srcnodata -3.4028234663852886e+38 \
          EstRN.img EstSh.img icu.tif

then it should be pretty similar.  There are subtle differences
of course.

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    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list