[Geotiff] RE: [Tiff] Re: get tifftag_geoasciiparams string

Niles Ritter ritter at earthlink.net
Sat Feb 3 17:38:47 EST 2007


In the TIFF spec it indicates that an ASCII tag can, theoretically,
contain multiple values, each separated by a NULL terminator. This
has proven to be a problem in practice, and so no one really uses
multi-valued ASCII tags as described in the TIFF spec.

The TIFFGetField should return the number of null-terminated
strings, and not the length. For most TIFF tags on the planet,
you should therefore get either 1 or 0.

To avoid null-termination miseries, the GeoTIFF spec stores 
its strings in a single ASCII tag, with '|' pipe-delimiters 
(tacitly assuming that the data itself contains no pipes). So,
calling TIFFGetField directly on a GeoTIFF image should give
you back a value of 1, and store the string in &data. It is
up to you to parse out the separate pipe-delimited values.

Not sure why you want to use the lower-level libtiff to
roll-your-own GeoTIFF, but best of luck, in any case. The
first thing you will find is that you will, at least, need
to use the "xtiff" tiff-extender code in the libgeotiff 
source so that the libtiff image-tag parsing code will
recognize the "unknown" GeoTIFF tags.

--Niles.

On Fri, 2007-02-02 at 10:36 -0900, Gennady Khokhorin wrote:
> Thanks, Phil, for respond.
> I agree: docs are pure. I have the same manual.txt for libgeotiff.
> 
> Still can not find any reference for return from TIFFGetField(tif, TIFFTAG_GEOASCIIPARAMS, &data)
> command. The other two return number of elements as a parameter:
> TIFFGetField(tif, TIFFTAG_GEOKEYDIRECTORY, &size, &data);
> TIFFGetField(tif, TIFFTAG_GEODOUBLEPARAMS, &size, &data);
> 
> TIFFGetField() description in tiff-3.8.2\html\man\TIFFGetField.3tiff.html shows
> in "Autoregistered tags" sample that ascii tag should be handled the same way. But 
> real code is different.
> 
> I want to use TIFF approach to handle tags (shorts, doubles, ascii) as an arrays
> rather then GTIFFKeySet/GTIFFKeyGet for each tag. Thanks to gdal it handles geoTiff
> great.
> 
> Any help, please!
> 
> Gennady
> 
> -----Original Message-----
> From: tiff-bounces at lists.maptools.org
> [mailto:tiff-bounces at lists.maptools.org]On Behalf Of Phil Harvey
> Sent: Thursday, February 01, 2007 3:08 PM
> To: tiff at lists.maptools.org
> Subject: [Tiff] Re: get tifftag_geoasciiparams string
> 
> 
> Sorry, I meant to give you this reference so you can download the 
> GeoTiff library, which I believe includes documentation:
> 
>   ftp://ftp.remotesensing.org/geotiff/libgeotiff/libgeotiff-1.2.3.tar.gz
> 
> - Phil
> 
> _______________________________________________
> Tiff mailing list: Tiff at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
> 
> _______________________________________________
> Geotiff mailing list
> Geotiff at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/geotiff



More information about the Geotiff mailing list