my-server
← Wiki

Esri TIN

The Esri TIN format is a popular yet proprietary geospatial vector data format for geographic information system (GIS) software for storing elevation data as a triangulated irregular network. It is developed and regulated by Esri, US. The Esri TIN format can spatially describe elevation information including breaking edge features. Each points and triangle can carry a tag information.

A TIN stored in this file format can have any shape, cover multiple regions (e.g. islands) and contain holes (e.g. lakes).

In 2007 a reverse-engineered description of Esri TIN format came to light. Since then, the Virtual Terrain Project, an open-source software, has implemented support for reading the format, without the need of ArcGIS being installed.

Overview

The Esri TIN format is a digital vector storage format for storing elevation information including breaking edge features. The Esri TIN format was introduced with ArcView GIS.

The Esri TIN format consists of a collection of files with specific filenames and a common filename extension, stored in the same directory. Most of the files are mandatory files (<kbd>tdenv.adf</kbd>, <kbd>tedg.adf</kbd>, <kbd>thul.adf</kbd>, <kbd>tmsk.adf</kbd>, <kbd>tmsx.adf</kbd>, <kbd>tnod.adf</kbd>, <kbd>tnxy.adf</kbd> and <kbd>tnz.adf</kbd>), optionally a file containing the coordinate system and projection information (<kbd>prj.adf</kbd>) and files containing point tag information (<kbd>tnval.adf</kbd> and <kbd>tndsc.adf</kbd>) and triangle tag information (<kbd>ttval.adf</kbd> and <kbd>ttdsc.adf</kbd>) can be given.

Mandatory files :
  • <kbd>tdenv.adf</kbd> — header and statistical data
  • <kbd>tedg.adf</kbd> — edges data and topology
  • <kbd>thul.adf</kbd> — outer and inner hull polygon data
  • <kbd>tmsk.adf</kbd> — mask data, masks invisible triangles
  • <kbd>tmsx.adf</kbd> — index file for <kbd>tmsk.adf</kbd>
  • <kbd>tnod.adf</kbd> — triangle node data
  • <kbd>tnxy.adf</kbd> — position information (x and y coordinates)
  • <kbd>tnz.adf</kbd> — height information (z values)

The endianness of most of the files is big-endian. <kbd>tmsk.adf</kbd>, <kbd>tmsx.adf</kbd> and <kbd>tdenv.adf</kbd> have mixed endianness.

Other files :
  • <kbd>prj.adf</kbd> — projection description, using a well-known text representation of coordinate reference systems; are single line <kbd>{B286C06B-0879-11D2-AACA-00C04FA33C20}</kbd> signifies an unknown coordinate system
  • <kbd>tndsc.adf</kbd> — statistic on point tag usage
  • <kbd>tnval.adf</kbd> — point tag data
  • <kbd>ttdsc.adf</kbd> — description of triangle tag data
  • <kbd>ttval.adf</kbd> — triangle tag data

The endianness of the file <kbd>tndsc.adf</kbd> and <kbd>tnval.adf</kbd> is little-endian.

Files generated by ArcGIS 10 :
  • <kbd>tnodinfo.adf</kbd> — point types and more
  • <kbd>teval.adf</kbd> — edges data
  • <kbd>tdenv9.adf</kbd> — the file <kbd>tdenv.adf</kbd> renamed
Size of file

A TIN with <kbd>n</kbd> points (incl. superpoints) and <kbd>k</kbd> triangles, the file sizes calculate to:

  • <kbd>tnxy.adf</kbd> : 16*<kbd>n</kbd> bytes
  • <kbd>tnz.adf</kbd> : 4*<kbd>n</kbd> bytes
  • <kbd>tnod.adf</kbd> : 12*<kbd>k</kbd> bytes
  • <kbd>tedg.adf</kbd> : 12*<kbd>k</kbd> bytes
  • <kbd>tmsx.adf</kbd> : 116 bytes
  • <kbd>tdenv.adf</kbd>/<kbd>tdenv9.adf</kbd> : 104 bytes
  • <kbd>tmsk.adf</kbd> : 132 + 4*ceiling(<kbd>k</kbd>/32) bytes
  • <kbd>thul.adf</kbd> : min. 12 bytes, depends on the number of points in the convex hull polygon
  • <kbd>tndsc.adf</kbd> : 24* the number of tag entries specified in <kbd>tndsc.adf</kbd> bytes (see below)
  • <kbd>tnval.adf</kbd> : 4*<kbd>n'</kbd> bytes (n': number of tagged points, incl. superpoints; see below)
  • <kbd>tnodinfo.adf</kbd> : 2*<kbd>n</kbd> bytes
  • <kbd>teval.adf</kbd> : 16* the number of breaking edges entries specified in <kbd>tdenv9.adf</kbd> bytes (see below)

Mandatory files

<kbd>tnxy.adf</kbd> - X and Y coordinates of the points of the TIN

Contains and array of X and Y coordinate values, one pair for each point of the TIN. The data set for each point can be described by the following structure:

<kbd>tnz.adf</kbd> - Z coordinates of the points of the TIN

Contains an array of Z coordinate values, one for each point of the TIN. The values are in same order as the values in <kbd>tnxy.adf</kbd> and together store the 3 dimensional coordinate of each point of the TIN. The data set for each point can be described by the following structure:

<kbd>tnod.adf</kbd> - Indices of the points that form the triangles of the TIN

Contains an array of indices to the points that form the triangles of the TIN, 3 indices for each triangle. The indices are in the range of 1 to the number of points ([1, # of points]). The front face of a triangle (usually the upper side) is that face, that has the 3 points/corners ordered clockwise when viewed. The data set for each triangle can be described by the following structure:

<kbd>tedg.adf</kbd> - Topology of the triangles and the type of its edges

Contains information about the topology of the triangles and the type of their edges.

There is an entry for each triangle with each 3 indices, that point to the position (number of the index) in <kbd>tnod.adf</kbd> file to identify the triangle, that shares an edge with the triangle described by the current data set, and the point of that triangle, that form that edge.

For each triangle in <kbd>tnod.adf</kbd> exists a data set at the same file location in <kbd>tedg.adf</kbd>. Each of the values point to the location in <kbd>tnod.adf</kbd>, where the point is specified (the index of that point) that form an edge. At the same time, since the location in <kbd>tnod.adf</kbd> and <kbd>tedg.adf</kbd> correspond, each of the values point to the location in <kbd>tedg.adf</kbd>, where the location of the value is specified. Rule: If edge a of triangle A points to edge b of triangle B, then edge b of triangle B must point to edge a of triangle A. Since edge definition in <kbd>tedg.adf</kbd> and point definition in <kbd>tnod.adf</kbd> of each triangle are at the same location the files, the indices in <kbd>tedg.adf</kbd> point to the point definition in <kbd>tnod.adf</kbd> of the neighbouring triangles.

The indices encode the actual index and type of the edge. The actual indices are not file offsets in <kbd>bytes</kbd>, but rather in <kbd>int32</kbd> values, in the range of 1 to the number of points ([1, # of points]). If the value is negative (bit 31 is set) the edge is a breaking edge. Furthermore, bit 30 of the <kbd>int32</kbd> values is used to determine if the edge is a hard or soft breaking edge. If the actual index would be <kbd>1234</kbd> (0x000004D2) then a hard breaking edge would be encoded as <kbd>-1234</kbd> (0xFFFFFB2E) and a soft breaking edge as <kbd>-1073743058</kbd> (0xBFFFB2E). The edge definition of the neighbouring triangle must mirror the edge type. ATTENTION: This behaviour has changed since ArcGIS 10. Please compare with the information given in section 'Format changes and files new with ArcGIS 10'.

The data set for each triangle can be described by the following structure:

<kbd>tdenv.adf</kbd> - Header or statistics

This file contains information that could be seen as a mix of file header and statistic data.

<kbd>thul.adf</kbd> - Hull, bounding polygon and holes

Contains an array of indices and separators, that defines the outer boundary of the TIN and its holes. The indices are in the range of 1 to the number of points ([1, # of points]). The separators are -1 (0xFFFFFFFF) and zero (0).

If the TIN is constructed using superpoints (usually the first 4 points), <kbd>thul.adf</kbd> lists the indices of these points and then <kbd>-1</kbd> (0xFFFFFFFF). After the separator follows one or more lists of indices that form bounding polygons (outer boundaries) and maybe holes (inner boundaries). These lists are separated by zero (0) values.

If the TIN does not contain superpoints, <kbd>thul.adf</kbd> starts with the <kbd>-1</kbd> (0xFFFFFFFF) separator, which is followed by one or more lists of indices that form bounding polygons (outer boundaries) and maybe holes (inner boundaries). These lists are separated by zero (0) values.

The indices and separators are 4 byte integer values (int32), stored in big-endian byte order.

<kbd>tmsk.adf</kbd> - Mask

Contains an array of bits (stored in 4 byte integers) that specify the visibility of the triangles of the TIN. This can be used to hide the triangles inside of terrain holes or outside the terrain (outside the outer boundaries).

The file is stored using the same structures (header and records) as a shapefile, but since it only stores the visibility values of the triangles many fields of the header are used.

The file header is fixed at 100 bytes in length and contains 17 fields; nine 4-byte (32-bit signed integer or int32) integer fields followed by eight 8-byte (double) signed floating point fields:

The file then contains at least 2 records. Each record is prefixed with a record-header of 8 bytes:

Following the record header is the actual data.

Record 1: The data of record number 1 is 2 word long and contains only the size of the data of record number 2 in 4 byte integers, stored as 4 byte integer (big-endian) itself.

Record 2: The data of record number 2 contain the following variable length structure:

Bit 0 (least significant bit) of the first integer contains the visibility flag (invisible if set to 1) of the first triangle defined in <kbd>tnod.adf</kbd>. Bit 1 of the first integer contains the visibility flag (invisible if set to 1) of the second triangle, and so on. All 32 bits of the integers get used (no sign bit).

Record 0: Records with the record number 0 must be ignored.

<kbd>tmsx.adf</kbd> - Index file for the mask

The index file contains the same 100-byte header as the <kbd>tmsk.adf</kbd> file, followed by any number of 8-byte fixed-length records which consist of the following two fields:

Using this index, it is possible to seek backwards in the <kbd>tmsk.adf</kbd> file by, first, seeking backwards in the index (which is possible because it uses fixed-length records), then reading the record offset, and using that offset to seek to the correct position in the <kbd>tmsk.adf</kbd> file. It is also possible to seek forwards an arbitrary number of records using the same method.

Optional files

Depending on the information stored in the TIN, some extra files are needed.

<kbd>prj.abf</kbd> - Projection and CRS

Contains the coordinate system and projection information. The file can be either in the Esri flavour of the well-known text representation of coordinate reference systems format (WKT), a simple keyword-value notation (Keyword: <kbd>Projection</kbd>, <kbd>Datum</kbd>, <kbd>Spheroid</kbd>, <kbd>Units</kbd>, <kbd>Zunits</kbd>, <kbd>Xshift</kbd>, <kbd>Yshift</kbd>, <kbd>Zone</kbd>,...) or have a single line <kbd>{B286C06B-0879-11D2-AACA-00C04FA33C20}</kbd>, which signifies an unknown coordinate system.

<kbd>tndcs.abf</kbd> - Statistic of tag usage

Contains an array of 24 byte big data set, one for each used tag. The data set contains the tag and the number of points with that tag. Each data set is structured as follows:

<kbd>tnval.abf</kbd> - Point tag file

Contains are array of 4 byte integer value, one for each (tagged) point of the TIN. The values are stored in little-endian byte order. Superpoints have the value <kbd>0</kbd> (zero). Points without a tag (e.g. points added by breaking edges) must be stored last in the TIN, and don't have an entry in this file.

Format changes and files new with ArcGIS 10

Since ArcGIS 10 there were some changes in the TIN file format. 2 new files (<kbd>teval.dbf</kbd> and <kbd>tnodinfo.dbf</kbd>) and 1 file got remained.

<kbd>tdenv9.dbf</kbd> - <kbd>tdenv.dbf</kbd> renamed

The file structure remains the same, just the field containing the number of breaking edges is additionally used.

<kbd>tnodinfo.dbf</kbd> - More information for the points

Contains an array of 2 byte integer values. One <kbd>short</kbd> for each point. The purpose is still not publicly known. So far it seems to be some kind of bitmask or code, describing the usage of the point. The values seem to be stored in big-endian byte order.

<kbd>teval.dbf</kbd> - The new breaking edge file (part 1)

Contains an array of data sets defining the breaking edges of the TIN, two for each breaking edge (one for each direction). Each data set is 16 byte long and structured as follows:

<kbd>tedg.dbf</kbd> - The new breaking edge file (part 2)

Since ArcGIS 10 this file has changed a little. It still contains a dataset for each triangle, and the references/indices of regular edges are unchanged, but the encoding of breaking edges is different. Breaking edges are still marked using negative values, but the index don't point to the file position in <kbd>tnod.dbf</kbd> and <kbd>tedg.dbf</kbd> anymore, instead the absolute of the value is the number of the entry of the breaking edge in <kbd>teval.dbf</kbd>. The encoding of soft edges has moved to <kbd>teval.dbf</kbd>, too.

Superpoint

In this article the term 'superpoint' is used at several locations. In the absence of an official file format description this term was chosen to reflect the properties of these points. (They could also have been called 'metapoint', 'extrapoint', 'infinity point' and many more.) An superpoint in the context of the Esri TIN file format is an additional point added by the ArcGIS software during triangulation/generation of the TIN. ArcGIS usually adds 4 of these points, one each west, north, east and south of the regular TIN points, at an extremely high distances. The superpoints are usually the first points in the point files <kbd>tnxy.adf</kbd> and <kbd>tnz.adf</kbd>. The triangles that are built with these points are usually masked (made invisible) in the <kbd>tmsk.adf</kbd> file.

See also

References

External links