[gdal-dev] Re: Strange behavior of gdalwarp with -overwrite option
Jukka Rahkonen
jukka.rahkonen at mmmtike.fi
Tue Nov 8 13:18:19 EST 2011
Alexander Bruy <alexander.bruy <at> gmail.com> writes:
>
> Hi all,
>
> in gdalwarp documentation [0] listed option "-overwrite" with next description:
> -overwrite:
> (GDAL >= 1.8.0) Overwrite the target dataset if it already exists.
>
> But when I try to reproject image using next command
>
> gdalwarp -t_srs EPSG:4326 -overwrite mosaic.tif mosaic.tif
>
> i get next error
>
> Creating output file that is 9122P x 2341L.
> ERROR 4: `mosaic.tif' not recognised as a supported file format.
>
> and mosaic.tif becomes 8 bytes size file (seems only tif header).
> Is this bug or I misunderstand -overwrite option usage?
> Tested on Slackware 13.37, GDAL 1.8.1, released 2011/07/09.
>
> [0] http://www.gdal.org/gdalwarp.html
I bet you do not really want to overwrite the source image with the target image
because it will make you sad. Once gdal has written a beginning of the target
"mosaic.tif" you have deleted the original "mosaic.tif" and there is nothing
more to convert. Put that command into a patch file and you can wipe a few
hundred originals in some seconds so effectively that even data recovery
companies cannot get them back. I've tried it and I do not recommend it for
anybody else.
Gdalwarp -overwrite source.tif target.tif should overwrite the old existing
target.tif and that is a reasonable command sometimes.
-Jukka Rahkonen-
More information about the gdal-dev
mailing list