TopoToAlbers: How to use it

This program is primarily meant for use with the Global Relief Data CD-ROM from the National Geophysical Data Center (Boulder, Colorado). This CD-ROM contains binary versions of the TOPO30 and ETOPO5 datasets; both datasets are strings of 2 byte integers arranged from left to right and top to bottom. Although the locations of these files are hardwired into the program for use with the CD-ROM, these codes will work with copies of the files made to other media; the code will provide an open dialog box indicating that you should locate the appropriate file. Simple modifications could allow the use of any similarly organized database (e.g., the 3" topography files available from some servers).

The basic purpose of this code is to make acceptably accurate projected versions of the topographic databases without having to resort to a GIS package. You are prompted for the database you desire (TOPO30 or ETOPO5) and the projection parameters necessary for an Albers Equal Area Conic projection, namely the two standard parallels (which generally should be about 1/6 of the way from the top and bottom of the map) and the origin, where the longitude of the origin should be the center of your map (the latitude isn't too important). The code uses the 1866 Clarke spheroid for North America. For maps of the entire U.S., the USGS uses standard parallels of 29.5 and 45.5 degrees and an origin of 0 latitude and -95 longitude. Although the use of the Clarke spheroid is incorrect for other parts of the world, the error is not too significant.

You also provide the latitude and longitude of opposite corners of the map. You are then asked if you wish to fill the entire rectangle or use the lat/lon boundaries as input. The first option will make a solid bitmap, complete as the original database allows, where the two corners specified will have the lat and lon as input; the latitude and longitude of the other 2 corners will be output to the screen. If you choose the swath (using the latitude and longitude bounds as input), then the output map will include all the terrain within your bounds and will have "no data" values (=-9999 for TOPO30 and -19999 for ETOPO5) for the points on the bitmap outside your lat/lon range (this happens because the meridians are no longer parallel in the projected map).

You also specify the number of pixels wide you wish the bitmap to be. Your ability to use the bitmap is limited by the space your computer might have; for best results anticipate using the output at a scale of 300 dots per inch and multiply accordingly. The code itself can handle output bitmaps up to about 500000 points wide, which should be much, much wider than anything you want. You will be told the height of the resulting bitmap in pixels--this is an important number. The size of the bitmap is also included in the default output file name; if you leave this appended to the name, Spyglass Transform will correctly infer the size of your file when you read it into that code (this is also a handy way of keeping some record of the size of the bitmap).

Output from the program is a binary file consisting of 2-byte integers going from left to right and then top to bottom over the area of your map. These integers are elevations in meters above sea level. There are three modes to this program: spot reprojection, averaging reprojection, and interpolating reprojection. You will be prompted for one of these modes after entering all the parameters needed to describe your map. In general, your map will look best if you just answer "yes" to the question ("Do you want to average?" or "Do you want to interpolate?"). In some instances, particularly if the resulting output file is to be used for purposes other than making a display map, you might wish to use a different option.

Spot reprojection
Once you have entered the parameters describing your map, the code cycles through the equivalent latitude,longitude pairs for the center of each pixel in the output bitmap. Values assigned each pixel are equal to the value at the equivalent latitude,longitude pair in the dataset chosen. Note that if your output points are much farther apart than the separation of gridpoints in the original dataset, you can "alias" topography into your final map. If your points are closer together than in the original dataset, you will see the grid of the raw dataset.
Averaging reprojection
For use only when your output bitmap is more sparse than the input dataset. The code calculates the minimum distance in latitude and longitude between adjacent pixels and determines how to average the original dataset. This averaged dataset is then sampled as in Spot reprojection. For instance, if the points in your output bitmap are no less than 1.5' apart in longitude and 2' apart in latitude, and you are using the TOPO30 dataset, the code will make a new dataset where each point is an average of 12 points (3 (=1.5'/0.5') in longitude and 4 (=2.0'/0.5') in latitude) and then sample that.
Interpolating reprojection:
For use when your output bitmap is comparable to or denser than the input dataset. This option uses a totally invalid assumption, namely that the elevations in the dataset are point samples (instead of areal averages) of a smooth function made at the center of each grid point. The code then calculates the value of this smooth function at each latitude and longitude pair representing the points in your output bitmap. The calculation is made using a cubic interpolation. The main advantage of this procedure is that you can produce visually acceptable maps at a resolution adequate for high-resolution output from a dataset that is too sparse to produce such high resolution.
A sample run is shown in the context of the Transform-related mapping codes
Return to Overview of Shaded Topography codes

Return to C.H. Jones home page

Craig Jones, cjones@mantle.colorado.edu