[Geotiff] Reading the Value/Offset of an IFD Entry

Niles Ritter ritter at earthlink.net
Fri Oct 26 11:54:02 EDT 2007


On Fri, 2007-10-26 at 10:10 -0400, Tillerson, Clint wrote:
> When reading the value/offset attribute for an IFD entry (Tiff tag),
> I’m confused about how you to know whether the offset should be read
> as a short integer vs. a long integer.

TIFF is based from the ground-up on offsets to data, which can be
anywhere in the file. Since TIFF files can be up to 4GB in size,
all offsets stored in TIFF are always LONG (4-byte unsigned integers
in the byte-order specified by the TIFF header).

http://partners.adobe.com/public/developer/tiff/index.html

> Here’s some background:  I’m writing a Fortran program that extracts
> land cover data from GEOTIFF files.

Ah, youth and high spirits. FORTRAN! It makes me nostalgic.

I wrote a FORTRAN TIFF parser back in the 80's, when I worked at 
NASA/JPL's image-processing center (MIPL). Believe me, you don't 
want to write a FORTRAN TIFF: that path is clouded by the Dark Side,
and will only lead you to suffering, and countless hours of
debugging (FORTRAN!). It's a good CS homework assignment, but not
a good investment of your (or your company's) developer time.

Do what I eventually did, abandon the FORTRAN TIFF project and
just use the (C-based)  "libtiff" library. It's as gold-plated 
as you can get. All Fortran compilers in this millennium 
support calls to C functions.  Reference:

http://www-mipl.jpl.nasa.gov/vicar/vicar250/html/vichelp/vtiff.html

Count your blessings; at least you weren't asked to write it in ADA !

--Niles.




More information about the Geotiff mailing list