DRGTools Version 0.22 - Initial Beta Release, March 11, 1999

DRGTools are a set of programs for manipulating USGS Digital Raster Graphics (DRG) Topographic Maps. DRG maps are described in detail at the USGS DRG web page.

These programs have been tested on hundreds of maps during their development, but some bugs certainly remain. Please let me know if you find circumstances in which they do not work. Alternatively, if you use them and find that they work well, please let me know that also. My e-mail address is msw@roadrunner.com.

The tools in this release are:

drginfo: Prints the quadrangle name, scale and datum of a DRG file.
drggrid: Overlays a UTM grid.
drgjoin: Seamlessly joins adjacent maps together.
drglzw: Converts a DRG file to LZW compressed form
drgpack: Converts a DRG file to PackBits compressed form

Windows 95/98/NT installation instructions

Shift-LeftMouse click on this link to download the drgtools.zip archive.

Use your favorite unzip proram to unzip it. I would suggest placing the files in c:\drgtools and then editing your autoexec.bat to place drgtools in your execution path, i.e. "SET PATH=%PATH%;C:\DRGTOOLS" These programs are intended to be run from an MSDOS window.

Linux installation instructions

Grab this binary distribution and do the usual things to it. There is also a statically linked version if you aren't running a libc6 system.

Other systems

This code should compile on any sort of UNIX system. If you would like to run them under Solaris or IRIX, I can make a set of executables for those. There will eventually be a source code release, but it is somewhat difficult to compile the code on anything other than a Linux system at present.

It is unlikely that I will be able to get these programs to work on a Mac, since I don't have access to one with the compilers and other necessary software libraries.

Copyright and Disclaimer

/* DRGTools -- Tools for manipulating USGS DRG files
 * Copyright (C) 1999 Michael S. Warren 
 *
 * These programs are free software; you can redistribute them and/or modify
 * them under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * These programs are distributed in the hope that they will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

Documentation on individual programs

drginfo

"drginfo filename" prints the filename, scale and name of the map. For example,

C:\msw\data>drginfo temp.tif
temp.tif      1:24000 NAD27 "Aspen Basin"
"drginfo -l filename" prints additional information.

C:\msw\data>drginfo -l temp.tif
temp.tif      1:24000 NAD27 "Aspen Basin"
Image Width: 5313 Image Height: 6732 Compression: lzw
Lat: 35.750 Lon: -105.750 Height: 0.125 Width: 0.125
Zone: 13 Pixelscale: 2.44 Origin (UTM): 420.110 3971.011
You can get a whole directory of map info by using the * filename wildcard

C:\msw\data>drginfo E:\DATA\*.TIF
will print the information for every map on the CD-ROM in drive E.

drggrid

"drggrid infile.tif outfile.tif" puts a UTM grid on infile.tif, and writes it to outfile.tif. The grid is 1km for 1:24k maps, and 10km for the other scales.

drgjoin

"drggjoin infile1.tif infile2.tif outfile.tif" joins the two maps specified, and writes them to a third file. The maps must be adjacent and the same scale, but can be either left/right or top/bottom neighbors and either 24k, 100k or 250k scale maps. You can join pairs of maps, and then join the resulting files together, and produce mosaics of 4 or more maps that way. The format of the output file is identical to the input files, so you can use the same viewing software you normally use to view the joined maps. If you want to view the resulting joined map in Fugawi, it needs a corresponding "outfile.fgd" file, which you can tell the program to generate by giving it the "-f" flag.

Example execution:

C:\msw\data>drgjoin -f e:\data\o35105f7.tif e:\data\o35105f8.tif temp4.tif
e:\data\o35105f7.tif  1:24000 NAD27 "McClure Reservoir"
e:\data\o35105f8.tif  1:24000 NAD27 "Santa Fe"
Joining East and West.
Done.

drglzw

"drglzw infile.tif outfile.tif" will use the more efficient LZW form of compression on infile, and write it to outfile. This typically makes the maps about 1/2 of their former size. "Imaging" in Windows 95 and "Imaging Preview" in Windows 98 (which you get by simply double-clicking on the image file) will show the lzw format TIFF files without any problem. Unfortunately, Fugawi does not read these files and gives a "DIB memory allocation error"

Example execution:

C:\msw\data>drglzw e:\data\o35105g7.tif temp.tif
e:\data\o35105g7.tif  1:24000 NAD27 "Aspen Basin"

drgpack

"drglzw infile.tif outfile.tif" will use the less efficient PackBits form of compression on infile, and write it to outfile. You need this program to undo the effects of "drglzw" on a file you want to read with Fugawi.

Michael S. Warren, msw@roadrunner.com