[gdal-dev] problems with gdal_merge.py

Frank Warmerdam warmerdam at pobox.com
Wed Apr 23 08:25:21 EDT 2008


Volker Wichmann wrote:
> Frank,
> 
> I've updated to 1.5.1: my former problem disappeared, but  NOW the ersi 
> ascii is off by half a pixel. I think the georeferencing is handled 
> incorrectly by the driver.
> Patching the driver with the following lines works for me:
> 
> in file aaigriddataset.cpp:
> 
> line 447
> - poDS->adfGeoTransform[0] = atof( papszTokens[i + 1] );
> + poDS->adfGeoTransform[0] = atof( papszTokens[i + 1] ) + 0.5 * dfCellDX;
> 
> 
> line 450
> - poDS->adfGeoTransform[3] = atof( papszTokens[j + 1] )
>            + poDS->nRasterYSize * dfCellDY;
> + poDS->adfGeoTransform[3] = atof( papszTokens[j + 1] ) - 0.5 * dfCellDX
>            + poDS->nRasterYSize * dfCellDY;
> 
> 
> line 460
> - poDS->adfGeoTransform[0] = atof(papszTokens[i + 1]) - 0.5 * dfCellDX;
> + poDS->adfGeoTransform[0] = atof(papszTokens[i + 1]);
> 
> 
> line 463
> - poDS->adfGeoTransform[3] = atof( papszTokens[j + 1] )
>            - 0.5 * dfCellDY
>            + poDS->nRasterYSize * dfCellDY;
> + poDS->adfGeoTransform[3] = atof( papszTokens[j + 1] )
>            - dfCellDY
>            + poDS->nRasterYSize * dfCellDY;
> 
> 
> I've cross-checked the results with Arc/Info and SAGA GIS and it works 
> fine now.

Volker,

You will need to file a ticket on this, and provide as much supporting
information (ie. .HDR files) as you can.

I'm pretty sure we have already gone through several iterations on this
so there is clearly something that isn't being properly understood.  I'm
not going to take your fix on faith, I need to know I'm actually fixing
things, not just stirring the pot again.

> Other issues I'd like to see mentioned on the gdal_merge.py page 
> (http://www.gdal.org/gdal_merge.html):
> - if the output file is already existing, the behaviour of the module is 
> indetermined as it tries to append to the file (?)

I don't know why you say this. If the output already exists, then the
script attempts to mosaic into it.

> - the -ul_lr arguments reference the cell CENTERS

The -ul_lr arguments are (to the best of my knowledge) outer pixel edges,
not cell centers.

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 OSGeo, http://osgeo.org



More information about the gdal-dev mailing list