[Geotiff] Re: bug in geotifcp?
Frank Warmerdam
warmerdam at pobox.com
Fri Oct 22 10:55:48 EDT 2004
Olivier Colin wrote:
> Hi again Frank
>
> I've a problem using geotifcp with a large number of tie points:
>
> I provided to geotifcp a tag file containing 17697 tie points, i.e.:
> ModelTiepointTag (35394,3):
> ... followed by 35394 ascii lines containing 3 numerics each separated by
> one blank
Oliver,
OK, I tracked through a ways and ran into quite a mess.
The TIFF format uses a 32 bit count value for the number of entries in a tag.
However, it seems that *most* of libtiff uses unsigned short for the count
for reasons that I don't know. So, when you pass more than
64K values your count is wrapped modulo 64K.
So:
35394 * 3 = 106182
106182 % 65536 = 40646
40646 / 3 = 13548
Libtiff does have a way of using 32bit integers for counts, but if I change
this to be used for the count for GEOTIEPOINTS every application that fetches
the tiepoints in the standard way:
uint16 nCount;
TIFFGetField(hTIFF,TIFFTAG_GEOTIEPOINTS,&nCount,&padfTiePoints );
Will no longer work. They will crash if TIFFGetField() starts interpreting
the nCount as 32bit.
Some sort of solution for this problem will be fairly involved mainly because
we need a strategy to avoid screwing up applications as new versions of
libgeotiff roll out.
Could you please submit this as a format bug report in the geotiff bugzilla
at:
http://bugzilla.remotesensing.org/enter_bug.cgi?product=libgeotiff
For now, if you want to produce GeoTIFF files with any hope of interoperability
in the world, you will need to restrict yourself to at most 11000 tiepoints or
so (64K/6).
I have also cc:ed this reply to the geotiff list since the issue may affect
lots of other folks.
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 Geotiff
mailing list