Building 100K Maps From USGS Data

Jack Cavanagh QBasic code to make APRS maps from USGS 100K:1 CD ROM. THis program can build city street level detail anywhere in the continental USA! As of APRS77c, the MK100k3.EXE no longer fits on the APRS distribution disk. You can download it from ARN BBS 410 280-2503 or get it vai ftp from tapr.org in the tapr/SIG/aprssig/files/upload area.

Version 1.0 released 23 Oct 95
Version 2.0 Released 27 Dec 1995
Version 2a Bug Fix 15 Jan 96 Fixed file name bugs
Version 3 Can make up to 676 (26 x 26) maps automatically!
Making APRS maps from the 100k CD is a two step process. First you use the CD programs to extract the raw map data from the CD to your hard drive. The second step is to run MK100K3.EXE which pulls the information from the hard disk files. APRS distribution now includes one 2 mile map made using this program. Zoom into 3909N and 07636W below 2 miles.

STEP ONE

It is assummed that you have already installed the CD support software on your hard disk following the instructions that come with the CD readme files. Create a blank sub-directory on your hard drive to store the data. I use the directory name 'dlg'. Be sure you have enough room as 6 Meg or more of hard disk could be required. Now run the program "extract.exe". Do this from a maximum user application memory (>512k) DOS configuration. Without enough memory, the program will appear to run but no files will be written to your hard drive.

The extract program draws a map of the area covered by the CD. Use either the arrow keys or a mouse to select the "SELECT QUAD" option. Move the cursor to the region of interest and click or hit ENTER. The screen is redrawn with the selected Quad divided into 15 minute grids. Now pick "SELECT LAYERS". Normally, select only the hydrography and transportation. When you click END SELECTION, a "SELECT 15' GRID" option will become active. Select it. Move cursor to the regions of interest and click or hit ENTER. Pick grids (usually up to four) that contain the area you want. If your area is near a grid corner, four will be required to get the area. If your area is near the corner of two or more QUADS, this process may have to be repeated to get the four nearest 15' grids for his home town map. Once you have the grids, choose "OUTPUT" and give a path to the directory on the hard drive to store the data. (If the output only appears to take a few seconds, you probably need more conventional memory) Get more memmory and try again. Exit the program.

Now confirm the files were written in the designated directory. Remember the path to this directory. NOTHING BUT CD MAP FILES MUST BE IN THIS DIRECTORY. ANY OTHER FILE GUARANTEES A PROGRAM CRASH. There is no way to know in advance what file names will come from the CD. The program must try to process all files in the sub-directory. Please do NOT make any sub-sub-directory under the map file sub-directory either.

STEP TWO: Execute MK100K3.exe

If you run the QBasic source code, you must use QB.exe with the /AH option. This is why the source code MK100k3.BAS will not run under QBasic.

OTHERWISE, run MK100k3.EXE. The program first asks for the path to the data files. I use 'c:dlg'. Next you are asked if the files came from the CD or from the internet. This determines if the file is de-blocked or not. CD files are 82 byte records with a CR/LF while internet files are only 80 bytes long.

Next enter a 6 character filename for the output. An extension of .MAP will be added if the output is under the 3000 point APRSdos limit or .DAT otherwise. Next you are asked for the latitude and longitude of the center of the APRS map. Enter this information in degrees and minutes. The APRS cursor is a good tool for identifying LAT/LONG. Decimal parts of the minutes are allowed e.g. 38,56.5. Do this carefully. Your coordinates must fall within one of the 15 minute grids previously extracted in step one.

FInally, enter the map radius in nautical miles. This is actually one- half the North-South span of the map. The East-West span will be 4/3 times this value. The level of road detail is controlled by the value of your input. Interstate, U.S. Routes and major state routes will be extracted for all maps. Secondary state routes (Class 3) will be extracted once the radius falls below 8 miles. Class 4 roads, real local stuff, appear once the radius falls below 2 miles. You have some control over this. If the map radius is preceeded with a minus sign (-) then the default class of roads is decreased by one but not less than class 2. Use this in dense urban areas. If the map radius is preceeded with a plus sign (+) then the default class of roads is increased by one but not more than class 4. Use this technique in sparse rural areas to get more cross-road landmarks.

MULTIPLE MAPS

You will be presented with an option to make more than one map during this session. You can make one, four, nine maps or NxM maps. A crude figure shows the relation of your input coordinates to the maps. For more than one map a two letter tag is added to the first six characters of your map file name. These tags are shown in the figure. The map radius still applies to each individual map. If you use the NxM option, the starting point is the lat/long of the upper left corner and not the center as in the 1, 4 and 9 map options. You will still get the 5 percent overlap so your input numbers will not show up exactly in the map files. The NxM maps are named with the last 2 characters being the first N and M letters of the alphabet in rows and columns.

For the next 5 to 30 minutes the code will grind away. As map features are found they are plotted on the screen. A status line on the top shows progress in the form of the total number of lines in the data file, a rapidly changing number of lines examined thus far and the number of lines accumulated for the map. As each file is processed, the program start time and file finish time is updated. When all files have been processed, the code tries to link as many short segments as possible into longer segments. Progress is shown as the maps lines change color to white (temporarily). The results are reported on the screen as the number of line segments and map points. Finally at the stroke of a key the display will show the map as it would appear in APRS. Exit BASIC at this point and the default drive will contain two files with your file name and the extentions .dat and .map. The raw data file .dat can be reworked with the MAPFIX program to delete unwanted features and make a new .map file that fits APRS. There is also a file 'temp' which was used as a working file. This is over written each time the program is run.

Hints and peculiarities

If the program outputs a .DAT file, then load the .DAT file into MAPFIX and tell it to TASK-SCRUNCH with a ratio of 1.2 (no more). Then go through every point in the map EDIT-DELETING any unnecessary points to ntil you get it below 3000 points. If it is below about 3500, I can usually find 500 points that can be eliminated using the +/- and EDIT-DELETE commands. Or you can TASK-TRIM to simply cut off the map edges...

These maps have limited river and stream information. They are on the CD but if there is no internal coding to distinguish between a short little stream and a signifcant river unless the river had two distinct banks on the original maps. Single line width rivers and streams are just not extracted. What we are left with is every little pond that has a "shoreline". If these are not significant to you edit them out with MAPFIX command "Kill feature". The line attributes on the CD do not distinguish between coast lines, river banks or lake shorelines. All are colored in dim cyan.

MK100K3 makes your map radius about 5% larger than the integer APRS scales of 1, 2, 4, 8, etc nautical miles. This is so that APRS will load the map at the indicated range with out a PERFECT placement of the cursor at the center.

The USGS Data User's Guide implies that political boundary and public land survey data is on the CD. This is not the case for the optional format CD. If city or county lines are significant to you, import them with MAPFIX from a map made from the 2,000,000:1 CD.

Some users have reported problems with no maps being produced. This appears to caused by a user map center and radius that does not fall within the region covered by the files. The already verbose error message has been expanded to reveal records 11 through 14 of the last file examined. These records define the four corners of the map data which can be compared with your input values to see were the mistake was made. It will be either a wrong map center or a bad choice of files.

MK100k3 halves the number of points extracted for shorelines as a brute force reduction technique. Also some shorelines are so long, that MK100k3 can not find the beginnning or end in the data. If such a line is omitted though, it is usually very noticable.

- I am still wary of how this code will perform in regions with extensive shorelines such as tidewater Virginia or Lousiana bayous. I need user feedback on this.

- If there is an overwhelming need for railroads, canals, trails, etc, a switch could be added.

Remember the map data is based on 15 minute USGS maps, although 7.5 minute maps may have been digitized. The maps extend 15 nautical miles north-south everywhere. The east-west extent depends on latitude. For the continental United States, this can range between about 12.6 nautical miles for the Florida Keys down to about 9.8 nautical miles for International Falls, MN. An APRS map is 4/3 as wide as it is tall. Thus a 1 radius mile APRS map covers 2 nautical miles north-south and about 2.67 nautical miles east-west. My point here is that even a one mile map could require extracting data from as many as 4 each of the transportation and hydrography map files and typically require two sets of these map files.

WB4APR COMMENT. Due to the TALL 15 minute box of raw data, and the FAT wide APRS display format, I use the following extraction method so that I can make the optimum coverage APRS map for a given 15 minute area as follows:

    * * * * * * *  Two 4.2 mile maps but ONLY if the area is very sparse
    *           *
    *           *        ----------+----------  Eight 2.1 mile maps
    * - - - - - *        |         |         |  should cover most mid USA
    *           *        |         |         |  latitudes quite well
    *           *        +--------(*)--------+
    * * * * * * *        |         |         |
                         |         |         |
                         +---------+---------+
                         |         |         |
                         |         |         |
                         +--------(*)--------+
                         |         |         |
                         |         |         |
                         ----------+----------

I get these 8 maps by just selecting Jack's 4 map option twice, once for the upper center of the 15 min cell, and again for the bottom center

ADDITIONAL COMMENTS FROM JACK ABOUT Version 3 or MK100K3.EXE

Version 3.0 Final release 29 Jun 96
Jack Cavanagh, KB4XF

This is an upgrade to MK100k2a.EXE with requested changes by WA4APR, KE4EER and W7KKE. Solved the file name problem caused by the different ways DOS and BASIC handle the "null" character and a bug in file pointers if you did not use a six character name. If you use less than six character names on multiple map files, it will now work! The intermediate data are now stored in a file "tmap.raw" before the short segments are chained together to avoid conflicts with TEMP directories. Ram drive: If you set up a ram drive, you can use it for tmap.raw to save mechanical wear-n-tear. To use the ram drive, start the program with the command:

     mk100k3 d:
where "d" is the drive letter of your ram drive created with ramdrive.sys in your config.sys. NOTE: This will probably cause the drive letter for your CD or zip or jaz drive to change. Be forewarned! To set up a ram drive from DOS add the following to your config.sys file:
     devicehigh=c:dosramdrive.sys 128 /E
     
This will set a 128K ram drive in extended memory. This is big enough for tmap.raw. Consult the DOS on-line help files if you want to use expanded memory or want a bigger ram drive. If you use Win95 use the following instead in config.sys:
     
     devicehigh=c:windowsramdrive.sys 128 /E
     
I have made sure that the last line in the output file contains "0,-1" The user now can get small road detail down to tracks and jeep trails. If you follow your maps radius value with an exclamation mark (!) you will get any and all data on the CD files including railroads, pipelines, etc. (if you extracted the data from the CD). You will also get every little stream and water filled ditch. Try this in an urban area and you will be running MAPFIX all night.

The program does not stop any more if there was no data to be found. It continues on until all possible maps for the current grid have been made or not made. A log files is written telling you the size of successful map builds in APRS map points and shows maps for which no data could be found in the files extracted from the CD to your hard disk. The log file has the name "filename.txt". "Filename" is what you typed in at the beginning of the mapping session.

The number of pixels per degree has been doubled to better match the scales used in APRS.

Oops! key. Hitting F10 will stop the program while making maps. This saves having to reboot if you realize that you made an input error.

Win95 and all that. This code was written in Microsoft QBasic 4.5 and the compiled .exe files will run under DOS, Windows 3.1 and Win 95. Win 95 opens mk100k3.exe with a small window, but this can be permanently fixed to a full size screen with the "properties" selection accessible with the right mouse button. You're on your own.

What's not finished

Some maps have missing line segments near the edges. Actually all maps have them, but they are only noticed when you get down to the 1 or 2 mile level. These are short straight lines that begin off the map and end on the map or vice versa. I have looked at the code and was able to handle the end of the line that goes off a map. I looked at the case of a line that begins off a map and concluded that a major re-write of one section will be necessary. I may get to this in a month or two but I am not in the mood at this time. Mapfix can add a short extension to the line if this is bothersome.

Hard copy of maps. PLOTMAP.EXE

Along the way, I have written a program that produces hard copy of APRS maps. You need to have a laser printer or ink jet printer that supports HPGL. The HP3 and HP4 series support the HPGL vector graphics. A preliminary version is available on request. A final version will be uploaded to tapr/sig/..... in a few weeks. The present version is limited in the number of maps that it can handle in its DOS based file selection menu. I have commissioned my son, Kevin, a recent computer science grad, to code a C++ routine that imitates a Windows file selection window with mouse support and is unlimited in number of files. If we can figure out how to link the QBasic and C++ object files we may have something. Drawing the maps was a breeze as APRS maps are vector graphic maps to begin with. In a regressive step, HP has eliminated the high level commands that used to draw and label axes in HPGL. Most of my time was spent coding little tic marks and labeling a couple of tic marks for reference. NO!, I will not make any changes or add more tic mark labels. The source code is available for any masochist who wants an improved hard copy.

Comments, bugs and suggestions are welcome. Contact me by packet at kb4xf@kc4asf.va.usa.na on packet or 223 N. Randolph Rd., Falmouth, VA 22405 by snail mail. I will be on the Internet in a few months.

Happy mapmaking and APRS operating, Jack, KB4XF

Jack Cavanagh, KB4XF Falmouth, VA kb4xf@kc4asf.va.usa


Return to Table Of Contents

Mail comments/corrections on content to Bob Bruninga and on HTML formatting to Steve Dimse