dlgvu.icn: Program to display USGS DLG map files

October 2, 2005; Gregg M. Townsend and William S. Evans
Contributor: Frank Glandorf
Requires: Version 9 graphics
This file is in the public domain.
Dlgvu displays and prints USGS digital map data.

usage:  dlgvu [options] file...

Each file argument is one of:
    a directory containing DLG files in SDTS format
    a ZIP format archive of such files  (requires "unzip" utility)
    a text file containing coordinates of paths and features

All interaction is via mouse actions and keyboard shortcuts.
The display window may be resized as desired.
____________________________________________________________

Command options:

-c          display coverage map only, without loading data
-d          print some debugging data
-n          no display; just report statistics, and then quit
            (this still requires X-Windows, unfortunately)
-p          use slower, more precise coordinate conversion
-q          quiet mode: no commentary to stdout
-t          load only maps traversed by paths, ignoring others
-o logfile  specify output log to use instead of standard output

-l abcd     display only layers a, b, c, d
-x abcd     exclude layers a, b, c, d

        For -l and -x, the following layer codes are used.
        (USGS equivalents are given in parentheses.)

        b  boundaries           (BD: boundaries)
        c  contour lines        (HP: hypsography)
        d  sand, gravel, lava   (NV: nonvegetative features)
        f  feature labels       read from text files
        g  GPS paths            read from text files
        l  land sections        (PL: public lands)
        m  markers              (SM: survey markers)
        n  file names
        o  other                unknown layers from non-DLG data
        r  roads                (RD: roads)
        s  structures           (MS: manmade structures)
        t  train tracks         (RR: railroads)
        u  utilities            (MT: miscellaneous transportation)
        v  vegetation           (SC: surface cover)
        w  water                (HY: hydrology)

Additionally, the standard Window() options are accepted;
in particular, "-F fgcolor" sets the color used for drawing
unrecognized ("other") layers, as from USGS "National Atlas"
digital files, and "-G 800x500" sets the initial window size.

Typical usage is simply
        dlgvu dir1 [dir2 ...]
to display one or more adjacent maps.  The -x option can speed
things up by excluding unwanted layers; the contour layer is
especially slow.

A ZIP archive can replace a directory name if Icon can open
the unzip program via a pipe.  For example:
        dlgvu woodside.zip palo_alto.zip
____________________________________________________________

Mouse actions:

To zoom to a particular region, sweep out the region using the
left mouse button.  To cancel a sweep, reduce its width or height
to fewer than ten pixels.

If nothing appears to be happening after zooming in, the program
is probably drawing offscreen.  It's not smart about that.  Be
patient, and it will soon display the visible region.

To display the latitude / longitude of a location, and a scale bar,
hold down the right mouse button.

To record a labeled feature, shift-click the left mouse button.
Enter a name in the pop-up dialog box.  The location and name are
written to the log file and added to the feature layer of the map.

To record an anonymous location to the log file, shift-click with
the right mouse button instead.  No dialog box appears.  A sequence
of anonymous locations can be read as a path by a subsequent
program run.
____________________________________________________________

Keyboard actions:

+ or =          zoom in
- or _          zoom out
0 or Home       zoom to initial view
arrow keys      pan the display  (hold Shift key for smaller pan)

b, c, d, etc.   toggle display of specified layer
a               display all loaded layers including n (file names)
x               display no layers (just an empty window)

Esc             stop drawing  (any unrecognized key does this)
space or Enter  redraw screen  (e.g. after inadvertent interrupt)
q               quit

p or PrntScrn   print visible portion to PostScript file

The file produced by PrntScrn is an Encapsulated PostScript file
suitable either for direct printing ("lpr file.ps") or for import
into another document.
____________________________________________________________

Input files:

In directories and archives, only files with names ending in .ddf
or .DDF are read; others are ignored.  These files must be in SDTS
(Spatial Data Transfer Standard) format, which is used by the USGS
for all new DLG files.

Text files supply coordinates for features or paths.  GPS receivers
are one possible source for such data.  A text file can supply
paths, features, or both.

Paths are specified by sequences of lines that end with two decimal
values.  The values are interpreted as latitude and longitude, in
that order.  An interruption in the sequence (such as a blank line)
indicates a break between paths.

Features, or waypoints, are given by lines that *begin* with two
decimal values.  The rest of the line is taken as a label, which
must not be empty and must not end with two decimal values.

Any other line in a text file breaks a path sequence but is
otherwise ignored.
____________________________________________________________

About DLG files:

Dlgvu was written to display digitized topographic maps produced
by the United States Geological Survey (USGS).  The current file
format is based on the Spatial Data Transfer Standard (SDTS).
Some older files are available in other formats (including
"standard" and "optional") not supported by this program.

DLG files are available free from the USGS at this web page:
        http://edc.usgs.gov/doc/edchome/ndcdb/ndcdb.html
Coverage is incomplete.  24K maps, the most detailed, are available
for only some areas, and many maps lack some of the data layers.

Each map is represented by a collection of gzipped tar files
(one for each map layer) that are unpacked for display.  Multiple
files versions may be available, and not all layers are available
for all maps.

IMPORTANT:  Do not blindly unpack all the tar files of a map into
the same directory; due to the use of duplicate file names in the
transportation layers, some files will be overwritten.  Instead,
unpack the roads, railroads, and miscellaneous transportation
layers separately, each time renaming the TR*.DDF files to RD*.DDF,
RR*.DDF, and MT*.DDF respectively.

Dlgvu has mainly been tested and tuned using "large scale" DLG
files (1:24000 scale, covering 7.5 minute quadrangles).  Other
scales produce less attractive displays, partly due to different
encodings:  For example, the same residential streets may be encoded
as "Class 3 Roads" in 24K files but "Class 4 Roads" in 100K files.

Dlgvu does not presume to understand ISO 8211, DDF, STDS, and TVP
in their full complexity and generality.  Undoubtedly it is making
some unwarranted assumptions based on observed practice.  The file
renaming recommended above is contrary to specification but allows
a complete map to be stored in a single flat directory.

For more information, and some sample data files, visit:
        http://www.cs.arizona.edu/icon/oddsends/dlgvu/
____________________________________________________________

Displayed features:

DLG files are rich in detail.  Dlgvu displays only some of this
encoded data.

Put simply, dlgvu understands point and line features but not
area features.  It draws a small square for a structure location,
or draws the outline of a large building, but it does not color in
an "urban area" in which individual structures are not plotted.
It displays the shoreline of a river, and any islands, but does
not understand enough to color the river area itself blue.

Dlgvu recognizes some line features for special display.  For
example, major roads are drawn with wide lines, and trails are
drawn with dashed red lines.  Lines with unrecognized attributes,
or no attributes, are drawn in a default style.  Point features
("school", "windmill", etc.) are not distinguished.

Area features are drawn only in outline.  The most obvious of
these are vegetated areas and urban areas.  Land section and
civil boundaries also delimit area features.

Colors are assigned as follows (with layer codes on the left):

        b  boundaries           gold
        c  contour lines        tan
        f  feature labels       black
        g  GPS path             bold pink over "highlighter"
        l  land sections        pale red
        m  survey markers       blue
        n  file names           green
        o  other data           brown (can override with -F option)
        r  roads, class 1-3     black or dark gray
        r  roads, class 4-5     dashed dark gray
        r  trails               dashed red
        s  structures           brownish gray
        t  railroads            rust
        t  rapid transit rails  dark blue
        u  pipelines            dashed purple
        u  power lines          purple
        u  airport runways      gray
        v  vegetation           light green
        w  water                light blue
        x  sand, gravel, lava   greenish gray

Dlgvu uses a simple rectangular projection that is satisfactory
for small areas like 24K quadrangles but less suitable for large
areas such as whole states.
____________________________________________________________

The loading process:

Data is loaded in two phases.  A quick preloading phase determines
the available layers and the geographic areas covered.  A status
line is output for each file.  For example:

        bcl-r-tu-w N27 15 C66 42a 93a  ia/ames-w

The first field shows which layers were found.  N27 declares that
coordinates use the NAD 1927 geodetic datum; N83 for NAD 1983 is
the other likely value.  15 is the UTM zone number; state maps with
latitude/longitude data show "LL" here.  C66 means that the data
appears to have been projected using the Clarke 1866 ellipsoid; the
other likely value is "G80" for the GRS 1980 ellipsoid.  Dlgvu uses
this to infer the datum, because the declared datum value is a less
reliable indicator.

"42a 93a" gives the coordinates of the southeast corner of the map,
in degrees North and West, with letters "a" through "h" indicating
fractions from 0/8 through 7/8.  The final field is the file name.

If the layers in a file are inconsistent (for example, in the
inferred ellipsoid), multiple lines appear with a "*" prefix.
If display of a file is suppressed by the "-t" option, an X
prefixes the line.

For text files, a notation such as "3:489+0" replaces layer
indicators, counting continuous segments, total points, and
feature labels.  Coordinate values are assumed to use the
WGS 1984 ("W84") datum and ellipsoid.

The display appears during the longer second loading phase.  For
each layer of each input file, bounds are drawn and a progress bar
changes as data is read.  The color of the label indicates the
layer being loaded.
____________________________________________________________

Tiling multiple maps:

Multiple maps are displayed in proper relation.  To quickly see
how the maps of a set will join, use "dlgvu -c".

Small gaps or overlaps occasionally appear along boundaries when
maps are tiled; these are symptomatic of inconsistent datums, and
they reflect the true relationships of the maps to the earth.

Dlgvu loads all necessary data into memory, so there is a very
real limit to the amount of data that can be displayed.  Contour
lines, especially, take lots of memory, but they can be excluded
by calling "dlgvu -xc".  A 128MB Linux system can typically
display three to five complex 24K quadrangles simultaneously
without thrashing.
____________________________________________________________

Known problems:

On Linux, we have seen occasional crashes of the XFree86 server,
especially under conditions of tight memory and/or extreme zooming.

Colors on printed maps vary somewhat from those seen onscreen,
depending on the printer.  Printed maps do not include the "n"
(file name) layer.

While data is being loaded from a ZIP file, interrupting with ^Z
can disrupt the "unzip" pipe and cause the program to crash or to
display artifacts after resumption.

Some 100K USGS maps come with multiple sets of boundary files,
leading to file name collisions for which no workaround has been
found.

Source code | Program Library Page | Icon Home Page