The database interface also includes functions to access database segments or layers. Segments are parts of the database that can hold various types of auxilliary information such as lookup tables, vector data, and ground control points. For example, lookup tables can be accessed using the DBReadLUT() and DBWriteLUT() intrinsics. The following example will read the lookup table in segment 5 of the already open file referred to by the handle fd.
local byte LookUpTable[256] call DBReadLUT( fd, 5, LookUpTable )
Similar functions exist to manipulate pseudocolor tables, DBReadPCT() and DBWritePCT().
Segments of a particular type may be located within a database file using the DBNextSeg() intrinsic. For example, to locate the first segment of type LUT:
local int segnum segnum = DBNextSeg( fd, "LUT", -1 )
The third argument is always -1 to find the first segment of the given type. To find the subsequent segment of the given type, the result from the previous call to DBNextSeg() should be given as the third argument. DBNextSeg() will return -1 if no further segments of the given type could be found.
The following example counts the number of LUT segments in the database file:
local integer NumLUTs segnum = DBNextSeg( fd, "LUT", -1 ) while ( segnum != -1 ) NumLUTs = NumLUTs + 1 segnum = DBNextSeg( fd, "LUT", segnum ) endwhile printf "The file contains %d lookup tables\n", NumLUTs
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.