[gdal-dev] Re: gdal_rasterize -tr and -te

Hermann Peifer peifer at gmx.eu
Wed Oct 6 09:20:27 EDT 2010


On 05/10/2010 19:40, Even Rouault wrote:
> Le lundi 04 octobre 2010 17:23:47, Frank Warmerdam a écrit :
>
>>> gdal_translate, gdalwarp, ...
>>
>> Even,
>>
>> I would suggest "-tap" for "target aligned pixels" to go with "-tr".  I
>> would think that gdalwarp, gdal_rasterize, and perhaps gdal_merge.py and
>> gdalbuildvrt would be appropriate applications to support this switch.
>
> Foks,
>
> I've followed Frank's suggestion. Please test the patch attached to
> http://trac.osgeo.org/gdal/ticket/3772 (applies cleanly on latest trunk,
> r20770) and report if it works as you expect. Then I'll commit it.
>
>>
>> I don't see how it would be appropriate for gdal_translate.
>>
>> Best regards,

I applied the patch and the corner coordinates seem to work fine for 
gdal_rasterize and gdalwarp. I haven't tried gdalbuildvrt. Perhaps 
someone else would like to test it?

On the other hand...

The new, target aligned tiffs do only have NODATA values, which seems to 
be related to ERROR 1:

$ gdal_rasterize --debug on --config GDAL_CACHEMAX 2000 -ot byte 
-a_nodata 0 -co compress=lzw -tr 255 255 -tap -l lu001l_luxembourg -burn 
1 -where CODE=111 lu001l_luxembourg.shp out.tif
OGR: OGROpen(lu001l_luxembourg.shp/0x1978ae0) succeeded as ESRI Shapefile.
GDAL: QuietDelete(out.tif) invoking Delete()
GDAL: GDALOpen(out.tif, this=0x19cbe00) succeeds as GTiff.
GDAL: GDALDefaultOverviews::OverviewScan()
GDAL: GDALClose(out.tif, this=0x19cbe00)
GDAL: GDALDriver::Create(GTiff,out.tif,224,321,1,Byte,0x1979ab0)
ERROR 1: Type mismatch or improper type of arguments to = operator.
GTiff: Adjusted bytes to write from 8064 to 7392.
GDAL: GDALClose(out.tif, this=0x19caf40)
GDAL: GDALDeregister_GTiff() called.

I am not sure if this new ERROR is related to your patch or some other 
changes which came through checking out -r 20770.

This error message is obvioulsy defined in from ogr/swq_op_general.cpp

Hermann


More information about the gdal-dev mailing list