[gdal-dev] Writing a Tiff

Frank Warmerdam warmerdam at pobox.com
Fri Jan 16 09:17:11 EST 2009


Henning Bredel wrote:
> ups .. sorry, I was on the R-sig mailinglist before, so I forget to
> point the language out explicitely. It's R -- I'm using GDAL with a
> wrapper package called `rgdal' (Roger Bivand is involved in its 
> development).

Henning,

Gotcha.

I will note that the R bindings are not generated using SWIG so some
of my assumptions in the previous email can be wrong.

> runs into the error (after approx. 30 sec.)
> 
> ,--------------------------
>  Wrong "StripByteCounts" field, ignoring and calculating from imagelength
> `--------------------------
> 
> What does this error mean??
> 
> Another strange thing is, that there is no GTiff support after
> that error anymore! The 2nd call of `getGDALDriverNames()' out-
> put is missing the GTiff entry at all. Could this be a GDAL 
> error or do I have to ask at the RGDAL mailinglist as well?

My guess is that there has been some sort of heap corruption.

Normally you would only get the "Wrong StripByteCounts" message when reading
a poorly generated TIFF file from an underlying library other than libtiff.
If you are getting it while operating on a TIFF file being generated with
libtiff (and GDAL) it likely means that the file was corrupted or that
the heap was somehow corrupted.   There could be quite a number of possible
reasons for this.

I will note that the GDAL geotiff writer in some cases stresses the limits
of libtiff and it can be important to have a very recent version (such as
the CVS head from the libtiff repository).  The version included with GDAL
internally is generally suitable.  Versions of libtiff provided with
software distributions are generally somewhat antique.

Nevertheless, your simple write through case is not a complicated one and
would not normally trigger problems.

Is it possible your TIFF file is growing to be larger than 4GB?  If you
are using an older non-BigTIFF version of libtiff this could cause issues.
Recent versions of GDAL will generally warn if this is likely to be a problem
but I don't recall your quoting the GDAL version number.

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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list