Idrisi and USGS Digital Raster Graphic (DRG) Images

Click HERE to download REDOC.EXE, REDOCW.EXE, and FRAME.EXE, described below.

Importing DRG Images into Idrisi

Clarklabs has announced the eventual release of a module to import (and perhaps export?) DRG images. As soon as I see its availability, I'll announce it and add a link. In the meantime, the guidelines below may be followed.

Because Idrisi currently lacks capability to read GEOTIFF files directly, the documentation recommends converting .TIF files to .BMP first (e.g. using Image Alchemy or Corel Photo-Paint), importing the .BMP files using BMPIDRIS.

Macro Example:

   BMPIDRIS x 2 i01 i01 drg
Once the image is imported, its georeferencing information must be entered. The program REDOC.EXE, executable from the MS-DOS prompt, reads the .FGD metadata file of a DRG image and enters the appropriate information into the .DOC file, optionally applying a y-shift to the coordinates. For example:

   redoc i01 i01
REDOC only affects the title, min. X, max. X, min. Y, max. Y, and resolution entries of the documentation file; other data (e.g. ref. system) will need to be entered manually.

WARNING: Although the projection and datum may be read from the .FGD file, the ellipsoid may not be correctly reported. For example, O35113G7.FGD reports "GRS 1980" but is actually "Clarke 1866". Thus the appropriate parameter file is US27TM12 rather than US83TM12.

Concatenating DRG Images in Idrisi

Because DRG images contain information outside the actual map area (titles, legends, etc.) it is necessary to set those cells to 0. This may be done by means of POLYRAS and OVERLAY.

WARNING: Avoid packbit compression during this process, as it may lead to image shifting.

1) Create a lat/long vector file representing the map area.

The program FRAME.EXE, executable from the MS-DOS prompt, reads the .FGD metadata file of a DRG image and writes out a vector file representing the map area in lat/long. For example:

   frame i01 i01


1 5
-113.875000 35.750000
-113.875000 35.875000
-113.750000 35.875000
-113.750000 35.750000
-113.875000 35.750000
0 0


file title  : Frame file
id type     : integer
file type   : ascii
object type : line
ref. system : latlon27
ref. units  : deg
unit dist.  : 1.0000000
min. X      : -113.875000
max. X      : -113.750000
min. Y      : 35.750000
max. Y      : 35.875000
pos'n error : unknown
resolution  : unknown
Note that the default ref. system is LATLONG. In the above example, the DRG uses the Clarke 1866 spheroid; thus the .DVC file has been edited to refer to a parameter file called LATLON27:


ref. system : Geodetic Coordinates (Latitide/Longitude)
projection  : none
datum       : NAD27
delta WGS84 : -8 160 176
ellipsoid   : Clarke 1866
major s-ax  : 6378206.40
minor s-ax  : 6356583.80
origin long : 0
origin lat  : 0
origin X    : 0
origin Y    : 0
scale fac   : 1.0
units       : deg
parameters  : 0
2) Project the vector file to the DRG's reference system.

MACRO Example:

   PROJECT x 2 i01 latlon27 i01p us27tm12
3) Convert the vector file to a raster mask and overlay the DRG image.

Use INITIAL to create an image from the DRG with a value of 0. Then use POLYRAS to add the vector file data to the image. Because the polygon's value is set to 1 and the INITIAL image is set to 0, the result is a mask that may be multiplied against the DRG image to zero out the margin area.

MACRO Example:

   INITIAL x i01v 3 1 0 1 i01 unspecified
   POLYRAS x i01p i01v
   OVERLAY x 3 i01 i01v i01ov
4) CONCAT the resulting images using the transparent option.

MACRO Example:

   CONCAT x # 4 drg 2 i01ov i02ov i03ov i04ov
WARNING: If the first image in the list is not leftmost AND topmost, the geopositioning of the output image will be thrown off. The program REPOS.EXE, executable from the MS-DOS prompt, reads the document files of the input and output images and corrects the positioning of the output image. For example:

   REPOS drg i01ov i02ov i03ov i04ov
This bug has been fixed. You can download the latest Idrisi update at:

[The remaining steps convert the margin areas back to white; they are optional.]

5) CONCAT the raster masks using the transparent option.

MACRO Example:

   CONCAT x # 4 drgv 2 i01v i02v i03v i04v
(See WARNING above.)

6) Use RECLASS to swap the 0 and 1 values.

MACRO Example:

   RECLASS x i drgv drgr 2 0 1 2 1 0 1 -9999
7) Use OVERLAY with the Cover option to create the final image.

MACRO Example:

   OVERLAY x 7 drgr drg drgw


If you're getting strange results using REDOC or FRAME, it could be because of nonstandard spacing in the .FGD file. The exact key phrases needed are as follows:


"8.4      TITLE:"
"3.4.2    ROW COUNT:"
"3.4.3    COLUMN COUNT:"


If you edit the .FGD file to match the above key phrases, the programs should work properly.

Some .FGD files contain bogus referencing information (I've noticed this with some Alaska quads). If this is the case, or if you don't have access to the .FGD file, REDOCW.EXE will fix the .DOC file using the .TFW file.

Return to Idrisi page