File ddfread.icn |
########################################################################### File: ddfread.icn Subject: Procedures for reading ISO 8211 DDF files Author: Gregg M. Townsend Date: June 26, 2000 ########################################################################### This file is in the public domain. ########################################################################### These procedures read DDF files ("Data Descriptive Files", ISO standard 8211) such as those specified by the US Geological Survey's "Spatial Data Transfer Standard" for digital maps. ISO8211 files from other sources may contain additional data encodings not recognized by these procedures. ddfopen(filename) opens a file and returns a handle. ddfdda(handle) returns a list of header records. ddfread(handle) reads the next data record. ddfclose(handle) closes the file. ########################################################################### ddfopen(filename) opens a DDF file, decodes the header, and returns an opaque handle for use with subsequent calls. It fails if any problems are encountered. Instead of a filename, an already-open file can be supplied. ########################################################################### ddfdda(handle) returns a list of records containing data from the Data Descriptive Area (DDA) of the file header. Each record contains the following fields: tag DDR entry tag control field control data name field name labels list of field labels format data format The records may also contain other fields used internally. ########################################################################### ddfread(handle) reads the next data record from the file. It returns a list of lists, with each sublist containing a tag name followed by the associated data values, already decoded according to the specification given in the header. ########################################################################### ddfclose(handle) closes a DDF file. ###########################################################################
This file is part of the (main) package.
Source code.Details |
Procedures: |
binary value of n bytes
delimited integer
integer of n digits
ddf_oneof(tabproc, moveproc, quantum)
delimited real
real of n digits
repeat sublist to EOR
delimited string
string of n characters
: close DDF file
: open DDF file
: read DDF record
Records: |
ddf_dde(tag, control, name, rep, labels, format, dlist)
tag | record tag
|
control | field control
|
name | field name
|
rep | non-null if labels repeat to end of record
|
labels | list of labels
|
format | format
|
dlist | decoder list
|
data description entry
proc | decoding procedure
|
arg | decoder argument
|
field decoder record
ddf_header(hcode, dlen, ddata, tsize, lsize, psize, s)
hcode | header code (R if to reuse)
|
dlen | data length
|
ddata | dictionary data (as a string)
|
tsize | size of tag field in dictionary
|
lsize | size of length field
|
psize | size of position field
|
s | header string
|
DDF header information
ddf_info(file, header, dlist, dtable)
file | underlying file
|
header | last header
|
dlist | DDA list (of ddf_dde records)
|
dtable | DDA table (indexed by tag)
|
basic DDF file handle