[gdal-dev] Return codes in gdalwarp
warmerdam at pobox.com
Fri Nov 13 09:12:01 EST 2009
Michal Migurski wrote:
> I think this is a bug report, or maybe a feature request.
> I'm writing a script that shells out to gdalwarp. The GTiff files that I
> might see as input to this script include palette and non-palette
> images, and I'd like to be able to reliably compress the output without
> human intervention.
> Initially, I tried -co COMPRESS=JPEG on everything in the hopes that
> gdalwarp would perform the necessary internal conversions to beat the
> output into a JPEG. This didn't work with palette images, for which I
> got an error like: "ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3
> not allowed for JPEG"
> Then I tried setting up a loop that tries JPEG first followed by LZW,
> but here I ran into difficulty recognizing a failure. The return code
> for the palette images with all the errors is still 0, just like the
> return code for a successful warp. The destination image is also
> populated, so it's not possible to check for existence to determine
> What I'd love to see is a modification to the command-line behavior of
> gdalwarp so it can be better used in a scripted setting, where automated
> ways of detecting failure that don't require reading the error output
> strings would be incredibly helpful. Ideally, choosing an incompatible
> creation option would cause a non-zero exit and wouldn't create the
> destination file.
gdalwarp attempts to exit() with a non-zero result on failure in cases where
a problem is detected. I imagine there are some failures to propagate some
kinds of errors back from the underlying layers - possibly even specific to
particular image drivers, or to the warp algorithm itself.
I would suggest filing a ticket with the particular case you encountered,
and enough information for us to easily reproduce the problem.
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