Be sure to read man drawmap. It is very good!
The binary .deb is about 200 kilobytes. Example data files that were used in testing and post processing were about 300 kilobytes. Images come in at about 60 kiloytes each, and to do a thorough job, I need about ten such images. Inclusion of test data and intermediary images would require about 900 kilobytes. It seems wasteful to bloat the package this much!
There are several types of input files that drawmap processes. The primary ones are Digital Elevation Maps (DEM), and Digital Line Maps (DLG). DEM files contain topographical information. DLG files contain information about features such as roads, streams, lakes and ponds. Drawmap can also process Geographical Name Information Service (GNIS) files. These files contain location of place name information. Drawmap can in fact read several other input file types, see the man page.
The primary source of suitable DEM and DLG datafiles for the U.S.A. is http://edc.usgs.gov/doc/edchome/ndcdb/ndcdb.html . Both the 1:250,000 and 1:24,000 are suitable for drawmap. If you are using acquiring data for the first time, you should look at the links labelled FTP by Graphics. These show the rectangle that each data file describes and gives you a very quick way of judging just how much you will need to get.
These data files tend to be moderately large. The 1:24,000 DEM file describing Midway, Kentucky is 160 kilobytes, compressed. The hydrology DLG file is 143 kilobytes, compressed.
The primary download site for U.S. GNIS data is:
http://mapping.usgs.gov/www/gnis/gnisftp.html
.
There are two formats for GNIS data on the USGS site, one is
in Quote and Comma Delimited form, and one is in Columnar form.
I have given examples in the Quote and Columnar form, because
I find it easier to use standard tools like egrep and text editors
in this form. Quote and Comma Delimited files have _deci as part
of their name.
GNIS files are ordinary text files. Each line is self contained,
and so, it is perfectly safe to use grep to select the region you
are working with, and then hand edit the output with your favorite
text editor. For example, I have been using the Midway section of Kentucky.
To find only the Midway data, I can simply
egrep \"Midway$\" KY_deci > KY_deci_Midway
These data files have two uses for us. First, they mark place-names
on the map, features like cities, villages, mountain names, rivers, isolated
churches, etc. They also allow us to mark features on our own. For example,
the low point of the Midway data is at 38.248N 84.7414 West. By adding a
line that reads:
"KY","Low Pt","locale","Woodford","21","239","381250N","0847500W","38.24800","-84.74140","","","","","789","1805","Midway"to the GNIS data, the area's low point can be labelled. Note that coordinates are repeated twice, once in a degrees/minutes/seconds format, and once in decimal format. (And that the data I show is not consistent!) Drawmap uses the decimal format to place features. East of the 0 meridian and north of the equator are positive, west and south are negative.
DLG data and DEM data are not congruent. DLG data produces an exactly rectangular patch. The projection produced by DEM data is more or less skewed, depending on how far from the equator you are. This is really quite annoying when working with hydrology data on the 1:24,000 scale. Streams may show up on the sides of hills, rather than in flood plains! This can be repaired by post processing.
Fonts are not attractive. Again, this is easily repaired by post processing.
See the new -C option to draw contour maps with color bands.
Political data, such as border lines are not available in a usable format, as far as I know.
Here are some hints on using the GIMP as a drawmap postprocessor.
I have previously obtained the Midway, Kentucky 1:24,000 DEM map,
which is stored ~/maps/dem/midway/9780CELO.DDF (there are other items in
the DEM data, but drawmap uses only the ...CEL.... file), the hydrology
DLG map store in ~/maps/midway/hydrology/HY01LE01.DDF (again, there are
multiple files in the directory, drawmap uses only the ....LE.... file), and
the Kentucky GNIS data, stored in ~/maps/gnis/KY_deci. I used
egrep "Midway\"$" ~/maps/gnis/KY_deci >~/maps/gnis/KY_deci.Midway
to select the portion of the GNIS data relevant to the Midway patch.
First, you want to draw many layers. Drawmap will automatically overlay data for you. Do not use this feature, especially if you are using a combination of DEM and DLG data! Instead, use drawmap to build each layer separately and GIMP to manipulate and the combine the layers.
Because there are a lot of steps and I do not want to bloat this package by including a bunch of images, I am going to describe, rather than show, the process of building a custom "3-d effect" contour map with hydrology and feature labels. This should be enough for you to see how to use most of drawmap's capabilities to produce a good map.
First, produce the basic contour map. I want color contours, but I don't
want them so tight that they are jarring. This is a matter of taste,
rather than science. For me, a 25 meter contour works well. Use
drawmap to build it by:
drawmap -C 25 -d ~/maps/dem/9780CEL0.DDF
This builds file drawmap.sun in your current working directory. Start up the GIMP. Open this file. Note that there is an information block at the top. In my case, it reads:
MIDWAY, KY - 24000 --- 38.125N, 84.75W to 38.25N, 84.625W Elevations: 681m (2234ft) at 38.248N 84.7414W, 924m (3031ft) at 38.13N 84.7147WThis information will e needed in the next step.
But first, to complete this step, convert the image to RGB using right-click/Image/Mode/RGB.
Now start another drawmap run, to produce the depth data. I used
drawmap -h -d ~/maps/dem/9780CEL0.DDFBe sure to note the pixel size this map produces, in my example x-width=376 and y-height=471 pixels.
This command should produce two files in your current working directory, drawmap.pgm and drawmap.pov. Drawmap.pov is suitable for input to the point of view ray tracer (povray). Usage of this file is beyond the scope of this document. Drawmap.pgm is a portable graymap file. Regions of lower elevation are deeper gray than those of higher elevation. This is just what is needed for the GIMP bump-map tool!
Open drawmap.pgm in another GIMP window. Select all (cntl-a), and copy (cntl-c). Go back to your GIMP window containing drawmap.sun. Right click and select Layers/Layers, Channels & Paths. In the Layer, Channels & Paths window right-click and select New Layer (or press cntl-n). The layer size is fine, but make sure that you select Transparent Layer Fill Type. Now return to your drawmap.sun window and paste the drawmap.pgm data into this new layer (cntl-v). You will find that the pasted map does not quite overlay the drawmap.sun image. Drag it until it exactly overlays the older image.
Now anchor the drawmap.pgm image (cntl-h). Finally, you are ready to give texture to your map. Right-click, select Filters/Map/Bump Map. You want Linear Map, and probably Compensate for Darkening. Azimuth controls the source of the virtual sun, with 0 corresponding to due East, 180 to due West. You should experiment with Elevation and Depth to get a satisfactory illusion of depth.
Back in the Layers, Channels & Colors box, select Mode Value or Mode Overlay.Either should result in a nice colored contour map, the colors coming from the bottom layer, and the illusion of depth coming from the bump-mapped layer. Value will emphasize the bump-map layer, and overlay will emphasize the contour.
Now we go back to drawmap to build a line graph map. The only one available from USGS for Midway is the hydrology map, which shows stream and ponds. drawmap needs either a DEM map or explicit boundaries to work with DLG maps. As mentioned earlier, if you use a DLG map directly on a DEM map, the result is inaccurate due to coordinate issues. So, we are forced to give direct coordinates, in my example, I run
drawmap -x 376 -y 471 -l 38.125,-84.75,38.25,-84.625 ~/maps/dlg/HY01LE01.DDF -o hydro.sunThe x and y dimensions came from the drawmap's report on the pgm file, the other dimensions come from the information block in the original drawmap.sun file, with North and East positive.
Open hydro.sun, copy it and paste it into a new layer of our composite drawing. If you look carefully, you will see a cut marks that frame the map we just produced. Drag guide lines to the inside of these cut marks. Once the guide lines are in place, use the Rectangular Selection tool to select the rectangle formed by these guide lines. Invert the region (cntl-i) and clear it (cntl-k). At his point, I am going to clear the rest of the white pixels of this layer away using right-click, Select/Select by Color, selecting any white pixel and pressing cntl-k. I find it easier to shear before scaling. Both vertical shear and horizontal shear are needed. It is easier to see what you are doing if you first select the rectangle delimited by the guide lines placed earlier. You may shear either horizontally or vertically first, just to make this paragraph easier to write, I will assume you shear horizontally first, To do this, select the Rotation, shearing, scaling, perspective tool, and click on the shearing radio-button in the Tool Option box. Now in our picture click on any point of the selected rectangle. You should now get a grid with the four corners contained in small boxes. Select one of the corners and drag it left or right until the vertical lines of the grid are parallel to the edges of the DEM data. Press Shear. Then do the same for the vertical dimension by choosing one of the boxes and moving it up or down.
The GIMP shears about the center point of the selected area. This moves the corners of the sheared area away from the corners of the original rectangle. You need to Select by Color the sheared data, and then move it so that one corner of the sheared data lies on a corner of the DEM data.
Now, you will find that the sheared data is too large. Use the Rotation, shearing, scaling and perspective tool again, this time in scaling mode. Drag the corner opposite the one that you chose in the previous step onto the corresponding DEM data. You maps should now be congruent to within a pixel or two.
This sounds really complicated, but in practice, can be done in two or three minutes, and it results in a vast improvement in the map!
Finally, we will use the GNIS data to label some place names on the map. Do you need to go through all of the rigamarole of the previous step to place the markers? In principle, yes. Realistically, this data is marking locales, and if you do not have any hydrological or transportation data on your map, then you can probably avoid it. Since this example does have such data, it is necessary to go through the distortion process again.
In one particular, this is actually a bit harder to do than the previous example indicated. Earlier, a Select By Color was done to highlight the rectangle being affected. Also, we had to align a point of the DLG data with a point of the DEM data. In this case, the reference points will probably not exist, and so must be added before processing proceeds.
For my map, the common points are the upper left hand and lower right hand corners. Use the cut marks to place guidelines around the figure. Select a 1-pixel brush and use the Draw Tool to build a little mark for the upper left and lower right corners. Select and clear so you can see underlying elements. Do the Shear, Shear, Move, Scale shuffle, as before.
This will distort both the text and the some of the markers. The text is no particular loss, GIMP fonts are much better than drawmap fonts anyway! Simply erase the current labels and replace them with nice GIMP Text Tool supplied ones. Because the markers are small, they will mostly remain undistorted, and any distortion is probably only one pixel. Either ignore it, or fix it using the draw tool.
Now, you should have a really accurate, colorful map. I would provide a screen shot, but since the image of the map is about the same size as the entire binary package, it seems wasteful to do so.
If you find any of this confusing, have corrections, or other requests, email me at jpenny@debian.org.
If you find other sources for data that work with drawmap, especially non-US data, please let me know so that I can give appropriate links.
Thanks
Jim Penny