2002.01.03 16:31 "Updates to unrecognised tag handling", by Frank Warmerdam

Folks,

Over the holidays I started work on something I have wanted for a long time. Basically, I have often wished that libtiff could carry unrecognised tags as well as the extensive list of recognised tags. The main justification for me is that it makes writing TIFF extensions (like GeoTIFF) much easier.

To that end, I have added logic (not yet in CVS) to:

On the libgeotiff side, I have successfully reengineered libgeotiff's libxtiff code to use the new mechanism. Now the geotiff tags are read, and handled directly by libtiff so xtiff.c is very simple. Adding tags types really just requires calling TIFFMergeFieldInfo() with the appropriate definitions. the SetField, GetField and PrintField methods no longer need to be overridden. Now libgeotiff just uses TIFFGetField() to fetch the geotiff tag values from libtiff.

The benefit for libgeotiff is that it no longer needs any private include files for libtiff to build, and changes to the TIFF and TIFFDirectory structure will have no effect on libgeotiff. As things stand now, building an application using libgeotiff with a separate libtiff.so is prone to violent crashes if a different libtiff.so is picked up at runtime... even a minorly different libtiff because of the dependences on structure layouts from libtiff in libgeotiff. I get regular reports of this. This is no longer true in new approach.

The benefit for other libtiff users is that new application specific tags can be added very easily. No overriding a whole bunch of functions, just merge in the field info at the appropriate point.

Furthermore, applications can carry and access arbitrary new fields, potentially even copying them to a new file in a systematic way.

Now the downside. The changes are significant, and of course the new libgeotiff depends on the new libtiff interfaces. For these reasons I am planning that the next release with this new approach will be libtiff 3.6.0, and libgeotiff 1.2.0. These first new releases will likely be considered experimental for a while.

A few questions have come up while I was working on this upgrade:

I would appreciate any input from libtiff (and libgeotiff) users with suggestions or concerns about the proposed changes. If anyone wants to review the new approach let me know and I will let you know when the code is in CVS.

Best regards,

-

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent