                            Laser-Scan Ltd.
                     LAMPS DTI File Specification
                  Extract from MATRIX Reference Manual
                      Issue 3.6 - 10-October-1996

Copyright (C) 1996 Laser-Scan Ltd, Science Park, Milton Road,
Cambridge, England CB4 4FY  tel: (01223) 420414


                              APPENDIX A




A.1  DTI FORMAT FILES

A DTI (Digital Terrain Image) file is  the means by  which  Laser-Scan
LAMPS  programs  hold grid based  geographic data,  and in  particular
elevation data in   the form of a DEM.  DTI files are the  native grid 
file format  of the OpenVMS-based LAMPS  software suite, and can  also
be read  and written by  the next-generation  Gothic products  such as
LAMPS2.

DTI files derive their name from 'Digital Terrain Image  Section.'  In
essence  they are images suitable for mapping into a program's virtual
memory space.  Once mapped into memory the data may be treated  as  an
array,  and accessed rapidly by application programs.  DTILIB provides
routines to perform this memory mapping and basic i/o operations.

A DTI file consists of a header and data area.  For most types of  DTI
file  the  header is of a fixed length (but see LSLA type file below),
and the data area is of a variable length.

Most DTI files created since 1985 use the LSLA type of header.


                                                              Page A-2


A.2  DTI HEADER

The information contained in the header allows an application  program
to determine the dimensionality of the matrix, the ground unit values,
and the location of the matrix on the earth's surface.  In the context
of a DEM, the structure of the header will vary with the source of the
elevation data.

DTILIB provides two routines  specifically  to  read  the  DTI  header
values.   The  first, DTI_READ_HEADER, reads the header record for all
DTI  files  and  puts  the  values  into  DTIHDR.CMN.    The   second,
DTI_READ_PROJ_REC,  reads  the  LSLA projection record if present, and
puts any values into DTIPROJ.CMN.   The  presence  of  the  projection
record is indicated by HAD_PROJ_RECORD(DTILUN) in DTIHDR.CMN, with its
details held in DTIPROJ.CMN.

5 different header structures may be distinguished, and identified  by
means  of  the header type identifier held in the first 4 bytes of the
DTI file:

     1.         UHL1    DTED Change 2

     2.         TED4    DTED Change 3/4

     3.         MIKE    (historical) from PANACEA modelling package

     4.         ALVY    (historical) ALVEY project file

     5.         LSLA    Laser-Scan Type A header format

In the latest implementation of  DTILIB,  the  MIKE  and  ALVY  header
formats  are now treated as historical.  The LSLA header replaces both
these formats.  If projection information is required to be stored  in
the header of the DTI file a LSLA header format should be used.

The following tables describe the length, offset and content of fields
in  the  different  DTI  headers.   The  length  and offset values are
specified in bytes.

                                                              Page A-3


A.2.1  UHL1 TYPE DTI FILES

UHL1 DTI files are derived from DMA-format files (DTED Change 2).  The
header of these images is a direct copy of the character data from the
UHL1 block at the start of the original tape file.

    Field length   Field offset          Description   

         4              0                Header Type Identifier = UHL1
        76              4                UHL Record

         2             80                X Data Extent
         2             82                Y Data Extent 
         4             84                X Grid Interval
         4             88                Y Grid Interval
         2             92                Minimum Byte or Word Data Value
         2             94                Maximum Byte or Word Data Value

         4             96                Minimum Long or Real Data Value
         4            100                Maximum Long or Real Data Value        
         2            104                Data Type Identifier

       150            106                Unused

                      256++              Data Area


A.2.2  TED4 TYPE DTI FILES

TED4 DTI files are derived from DMA-format files  (DTED  Change  3/4).
This  format does not retain the UHL1 record since all the information
in it is duplicated in the DSI and ACC records.  These latter  records
are stored as on the original tape.

    Field length   Field offset          Description   
        
         4              0                Header Type Identifier = TED4

         2              4                X Data Extent
         2              6                Y Data Extent 
         4              8                X Grid Interval
         4             12                Y Grid Interval
         2             16                Minimum Byte or Word Data Value
         2             18                Maximum Byte or Word Data Value

         4             20                Minimum Long or Real Data Value
         4             24                Maximum Long or Real Data Value        
         2             28                Data Type Identifier

       206             30                Unused

       648            236                DSI Record
      2700            884                ACC record
                     3584++              Data Area

                                                              Page A-4


A.2.3  MIKE TYPE DTI FILES

MIKE DTI files are derived from the PANACEA terrain  model  generation
package.   These  type  of  files  are  now  historical.   The current
implementation of DTILIB will read MIKE files, but  will  prevent  DTI
files with a MIKE header from being created.

    Field length   Field offset          Description   
        
         4              0                Header Type Identifier = MIKE

         2              4                X Data Extent
         2              6                Y Data Extent 
         4              8                X Grid Interval
         4             12                Y Grid Interval
         2             16                Minimum Byte or Word Data Value
         2             18                Maximum Byte or Word Data Value

         4             20                Minimum Long or Real Data Value
         4             24                Maximum Long or Real Data Value        
         2             28                Data Type Identifier

       226             30                Unused

                      256++              Data Area




A.2.4  ALVY TYPE DTI FILES

ALVY DTI files vary from other DTI files in having a  variable  length
header record.  The length of the record is defined by a header length
field (at byte offset 30) in the header.  These type of files are  now
historical.   The  current  implementation  of  DTILIB  will read ALVY
files, but will prevent DTI  files  with  a  ALVY  header  from  being
created.

    Field length   Field offset          Description   
        
         4              0                Header Type Identifier = ALVY

         2              4                X Data Extent
         2              6                Y Data Extent 
         4              8                X Grid Interval
         4             12                Y Grid Interval
         2             16                Minimum Byte or Word Data Value
         2             18                Maximum Byte or Word Data Value

         4             20                Minimum Long or Real Data Value
         4             24                Maximum Long or Real Data Value        
         2             28                Data Type Identifier
         2             30                Unsigned Word Defining Start of
                                         Data Area (ie. Length of Header)


                                                              Page A-5


A.2.5  LSLA TYPE DTI FILES

LSLA DTI files vary from other DTI files in having a  variable  length
header record.  The length of the record is defined by a header length
field (at byte offset 30) in the header.  These types of files are now
generated in most situations by Laser-Scan utilities.

    Field length   Field offset          Description   
        
         4              0                Header Type Identifier = LSLA

         2              4                X Data Extent
         2              6                Y Data Extent 
         4              8                X Grid Interval
         4             12                Y Grid Interval
         2             16                Minimum Byte or Word Data Value
         2             18                Maximum Byte or Word Data Value

         4             20                Minimum Long or Real Data Value
         4             24                Maximum Long or Real Data Value        
         1             28                Data Type Identifier
         1             29                Data Order Values (Corner of
                                         Origin and Direction)
         2             30                Unsigned Word Defining Start of
                                         Data Area (ie. Length of Header)


                                                              Page A-6


A.3  DTI DATA AREA

The structure of the data area is common to all types  of  DTI  files.
The  size  of  the data area is defined by means of the east and north
extent values in the DTI header.  The data values are  currently  held
as bit (binary), byte, word (INTEGER*2), longword (INTEGER*4) or real.
This may be determined from the header data type identifier.


The first data value encountered in the data array is  the  south-west
DTM  value.   The  final  data  value  is  the  north-east  DTM value.
Intervening data values are organised on  a  column  basis,  with  the
southernmost value of the column always being encountered first.


        s(1,1),s(1,2)..., s(1,n), s(2,1),... ..., s(e,1), ..., s(e,n) 


        where:  's' is the sample   s(1,1)= SW corner of the grid
                'n' is the north extent
                'e' is the east extent




        _________________________
        |       |       |       |
        |   3   |   6   |   9   |
        |       |       |       |
        -------------------------
        |       |       |       |
        |   2   |   5   |   8   |
        |       |       |       |
        -------------------------
        |       |       |       |
        |   1   |   4   |   7   |
        |       |       |       |
        -------------------------


[END]
