Convert a USGS DEM file into LAS image format
DEM2LAS reads elevation data from either a traditional USGS ASCII-format DEM files (file extension ".dem") or a SDTS (Spatial Data Transfer Standard) file set packaged as a Unix tape archive (file extension ".tar"), converts them to a standard LAS image file, and extracts the header data from the input file. The header data are formatted into an ASCII listing which may be displayed, printed, and/or saved in a file.
Input data in the traditional USGS ASCII format may be in fixed-length 1024-character records (the standard for USGS 9-track tape files), or may contain records of up to 1024 characters each terminated by linefeeds (the format used by some ftp sources). When the input is in SDTS format, the separate data descriptive files (DDF) which contain the header and elevation data for the DEM must be packaged into a single ".tar" file in the format created by the Unix "tar" and GNU "gtar" utility. If the input is in Unix (.Z) or GNU (.gz) compressed format, DEM2LAS will uncompress it automatically.
Some shortcuts have been used in processing SDTS-format data. These may cause problems if the USGS uses alternative implementations of the SDTS standard. See User Note 3.
- IN
- Input DEM file. Name of file containing DEM data in either standard USGS ASCII format or in SDTS format. An ASCII format file may contain either fixed-length 1024-character records or variable-length records of up to 1024 characters each terminated by a linefeed. The input file may be in compressed form (either .Z or .gz) form, in which case it is automatically decompressed.
- OUT
- Name of output LAS image. The output image size is displayed to the user after the header record has been read.
- FORMAT(--)
- Format of input file. Normally inferred from the file extension, but may need to be specified explicitly if input does not follow standard naming conventions.
"DEM" Traditional USGS ASCII format (file extension ".dem") "SDTS" Spatial data transfer standard (file extension ".tar" or ".sdts")
- FILL(0)
- Value for fill pixels. If the input DEM does not completely extend to the corners of the rectangular output image, the pixels for which DEM values are not available will be assigned the value specified by FILL.
- VOID(0)
- Value for void pixels. For the SDTS format, pixels are encoded as void if there is no value available for them even though they fall within the region nominally covered by the input DEM. For example, if the region extends across an international boundary, the points outside the U.S. may be encoded as void if DEM data are not available for them.
- PRINT(TERM)
- Destination(s) for text output. The program creates a listing of data from the DEM header records. This listing may be sent to one or more destinations as specifed by the value(s) entered for PRINT. Options are
TERM: Listing is displayed on the user's terminal. LP: Listing is sent to the printer defined by $PRINTER. filename: Listing is stored in a file with the specified filename; the file extension ".prt" is appended to the filename specified by the user.
The DEM data for the Tyrone quadrangle in file tyrone.dem will be used to create a LAS image named tyrone. A formatted listing of the DEM header data will be displayed on the terminal. The ".dem" extension on the input file name indicates that it is in the traditional USGS ASCII DEM format.
Since the input DEM coverage is defined by the latitude and longitude boudaries of a 7.5 minute map quadrangle, while the DEM data are on a rectangular UTM grid, the edges of the smallest rectangle in UTM coordinates which fully encloses the map quadrangle do not coincide with the edges of the quadrangle. As a result, there will be grid points near each corner for which no DEM values are supplied. These values will be assigned a value of 100 meters.
The DEM data for the Mingoville quadrangle in file mingoville_pa.tar.gz will be used to create a LAS image named mingoville. A formatted listing of the DEM header data will be displayed on the terminal and also written to file mingoville.hdr. The ".tar.gz" extension indicates on the input file name indicates that it is in SDTS format, and needs to be uncompressed before processing begins.
For input in traditional USGS ASCII format, the file contains three types of records: A, B, and C. The "A" record contains the header information for the file. The "B" data records each contain elevation data for one south to north column of grid points. Each of the "B" records contains header information for the column and the data records. The "C" data record (if it exists) contains confirmation (quality) data for the file.
For SDTS-format input, the header information is distributed among a number of DDF (data descriptive) files, and the actual elevation data are in an additional DDF file; all of the DDF files are packaged in a single Unix tape-archive (.tar) file.
The program begins by getting the program arguments. If the input format (FORMAT) is not given explicitly, the input file extension is checked to determine this format. If the input file is in a compressed format, DEM2LAS then opens a pipe to uncompress the input file.
If the input is in traditional USGS ASCII format, the program first reads and interprets the "A" record header data and determines the size and projection coordinates of the output image rectangle needed to contain the input data. The "B" record data are then read and converted to 16-bit binary elevation values above mean sea level, and output in standard LAS image format. The information from the "C" record, if any, is merged with the header data from the "A" record.
For SDTS-format input, all the DDF files in the tar archive are checked. If a give DDF file contains header information needed for the output listing, the necessary fields are extracted from the DDF. If the DDF contains actual elevation values, the starting location of the DDF within the tar archive is saved. When all DDF files have been processed, the DEM array dimensions from the header fields are used to read the elevation data, convert them to 16-bit binary elevation values, and output them in standard LAS image format.
The header data are then used to build the LAS data descriptor record file (DDR) for the image. A formatted listing of the header data is also generated.
The specified profile had fewer values than specified in the B-record header. The input file may have become corrupted. After ten missing entries are encountered, DEM2LAS aborts.
The input file header indicates that quality assessment data are provided in a type C record, but this record was not found. Input file may have become corrupted -- check that the output image and DDR files contain valid data.
Either the specified item was missing from the specified SDTS file, field, and subfield, or it contained an unrecognized value. The archive file may have become corrupted or new options may have been added to the SDTS encoding which are not supported by the current verion of DEM2LAS.
The coordinates of the upper left corner, from RSDF:SADR:X and Y or the coorindates of the lower right grid cell, computed from the upper left cell coordinates and the grid dimensions, do not fall within the maximum and minimum values of the corner coordinates specified by SPDM:DMSA:X and Y. The archive file may have become corrupted. As of June, 1999, the specification of the coordinates for the upper left grid cell in file RSDF for 7.5-minute DEMs was suspect, and often needed to be recomputed by DEM2LAS from the boundaries of the 7.5-minute quadrangle; in rare cases, this computation might be affected by roundoff errors. Use DSPDDR to verify the corner coordinates in the DDR.
DEM2LAS encountered a fatal error condition. The specific error condition is specifed by the error message immediately preceding this one. Messages identified by [dem2las-...] are explained below; other messages may be generated by a support function called by DEM2LAS.
The file specified by variable IN was not found, with or without .Z
or .gz extension. Check that file name and directory path were
entered correctly.
An error was encountered while trying to open pipe for passing input data to main program. See the LAS system manager.
An error was encountered while trying to open the input DEM file. See the LAS system manager.
An error was encountered while trying to allocate dynamic
memory. See the LAS system manager.
No data were obtained from the input. The message immediately preceding this one may indicate the cause. Check that the input file is not empty; otherwise, see the LAS system manager.
The data from the input file are not in standard DEM ASCII format. Note that digital elevation data in other formats can be processed by program DEMENTER.
The input header indicates that file contains data in random
spatial patterns rather than regular columns. DEM2LAS does not
support random data patterns. This message may also indicated that
the header recore has been corrupted.
The units code of the input header record is invalid. The input file is not in valid DEM ASCII format.
One or more corner-coordinate fields in the input header A record were missing. DEM cannot be georeferenced.
The x and y grid spacing is not specified or entered as zero in the input header A record. DEM resolution cannot be determined.
Input header specifies rectangular patches. The input file in not
in standard USGS ASCII DEM format.
Input file may contain less input data than indicated by header record. Otherwise, see LAS system manager.
The header for a profile data record (type B record) contained a
profile number out of sequence or otherwise invalid. Input file may
have become corrupted.
The northing for the start of current profile is less than minimum northing specified in file header. Input file may have become corrupted.
The input file format is not specified explicitly (by parameter FORMAT) and cannot be inferred from the file extension of the input filename. Check that filename is entered correctly; if filename extension does not indicate file format, enter value for FORMAT.
The specified .DDF file in the tar archive appears to be of type "CEL", but is neither "CELL" nor "CEL0". The program does not know how to interpret this. Please inform the LAS system manager.
The input file specified for SDTS-format elevation data does not contain header records in standard tar archive format. Check that the correct file has been specified.
There is more than one file in the SDTS tar archive whose name ends with the characters specified by <filetype>. The archive is not of a form which DEM2LAS can interpret.
The SDTS tar archive does not contain any file whose name ends with the characters specified by <filetype>. DEM2LAS cannot complete processing of the data without this file.
The SDTS tar archive contained a file with a record leader which could not be interpreted. This problem was encountered while searching for the field specified by <fieldname>. The archive file may have become corrupted.
DEM2LAS was unable to find the specified field in the expected SDTS file. The archive file may have become corrupted.
DEM2LAS was unable to find the specified subfield in the SDTS file containing the specified field. The archive file may have become corrupted.
A file already exists with the specified output file name. Delete the file (and its associated .ddr and .his files, if any) or specify a different output file name.
An error occurred when trying to open the output file. A preceding message may give additional information.
The ROWI subfield of the specified SDTS elevation data record contained a value which does not match the record number. The archive file may have become corrupted.
The specified SDTS elevation data record has a length for the cell values subfield which does not match the length for the first record. The archive file may have become corrupted.
An error occurred while trying to write to the output file. A preceding message may give additional information.
The specified SDTS file in the SDTS archive has internal index information which conflicts with the file length specified in the tar header record. The archive file may have become corrupted.
Either the specified item was missing from the specified SDTS file, field, and subfield, or it contained an unrecognized value. The archive file may have become corrupted or new options may have been added to the SDTS encoding which are not supported by the current verion of DEM2LAS.
The full SDTS standard uses the ISO 8211 (FIPS Pub. 123) encoding. This is supported by an extensive library for locating fields within records. The DEM2LAS implementation does not use this library, since the DEMs use a standard set of fields. However, different groups converting the DEMs to SDTS have used two different ways for encoding the actual elevation values and two different ways for encoding the X,Y coordinates at the upper left corner. DEM2LAS supports both of these options. However, it is possible that other options have been used for DEMs which were not available when testing was done.
SCALE COVERAGE DESCRIPTION ===== ======== =========== 1:250,000 Coverage of U.S. 3 x 3 arcsecond cell size (1 x 1 degree, nearing completion, (3 x 6 in Alaska) 2 or 3 files including most of No projection per map sheet) Alaska Elevation in meters 1201 lines x 1201 samples (601 samples in Alaska) 1:24,000 On-going effort, 30 meter cell size (7.5 x 7.5 approaching 50% UTM projection min., 1 file completion Elevation in meters per map sheet) ~475 lines x 335 samples