[gdal-dev] gdal_merge does not mosaic

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Jun 4 02:26:01 PDT 2013


adi_khan <adiba.nizami <at> gmail.com> writes:

> 
> <http://osgeo-org.1560.x6.nabble.com/file/n5057631/inputimgs.jpg> 
> <http://osgeo-org.1560.x6.nabble.com/file/n5057631/gdalinfo.jpg> 
> <http://osgeo-org.1560.x6.nabble.com/file/n5057631/output.jpg> 
> 
> Hi all,
> here please find the input and output I used.
> 
> The attached images :
> 1. First image is a snapshot of 2 input images in different views
> 2. gdalinfo of first and second image.
> 3. Output mosaic along with info.
> 
> Note :
> I used gdal_merge.py and gdalwarp as well. But the output remains the same.

Hi,

Lambert conformal conic is totally unknown system to me and I am not sure if
you should be able to use gdal_merge with your source images as they are at
all. The gdal_merge document page says:
"All the images must be in the same coordinate system and have a matching
number of bands"
If you compare the PROJCS parameters in the gdalinfo reports they are not
the same but I do not what gdal_merge thinks about that.

You were adviced to use gdalwarp as
gdalwarp -of HFA img1.img img2.img img3.img mosaic.img

I made some trials and it seems that if img1.img and img2.img are in
different coordinate systems then gdalwarp does not create correct output.
For me it is anyway not so good idea to run gdalwarp without giving -t_srs
parameter. Why to let some program to decide the target projection if you
can give it yourself and know for sure what will happen?

Another thing is that your images have nodata areas which appears to be
black. However, no colour is labeled as nodata colour in image metadata and
therefore gdalwarp believes that black borders belong to the images.

So my untested suggestion for the command is

gdalwarp -of HFA -t_srs [some_definition_here] -srsnodata 0 0 0 img1.img
img2.img mosaic.img

-Jukka Rahkonen-




More information about the gdal-dev mailing list