1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
|
<html>
<head>
<title>Drawmap Usage
</title>
</head>
<body>
<h2>See the man page</h2>
<p>Be sure to read <strong>man drawmap</strong>. It is very good!</p>
<h2>Why this document has no images</h2>
<p>
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!
<h2>Sources of data files</h2>
<p>
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.
<p>The primary source of suitable DEM and DLG datafiles for the U.S.A. is
<a href=http://edc.usgs.gov/doc/edchome/ndcdb/ndcdb.html>
http://edc.usgs.gov/doc/edchome/ndcdb/ndcdb.html
</a>. 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.
</p>
<p>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. </p>
<p>
The primary download site for U.S. GNIS data is:
<a href=http://mapping.usgs.gov/www/gnis/gnisftp.html>
http://mapping.usgs.gov/www/gnis/gnisftp.html
</a>.
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 <br>
egrep \"Midway$\" KY_deci > KY_deci_Midway
</p>
<p>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:<br>
<pre>
"KY","Low Pt","locale","Woodford","21","239","381250N","0847500W","38.24800","-84.74140","","","","","789","1805","Midway"
</pre>
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.
<h2>Limitations of the Program</h2>
<p>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.
<p>Fonts are not attractive. Again, this is easily repaired by post processing.
<p>See the new -C option to draw contour maps with color bands.
<p>Political data, such as border lines are not available in a usable
format, as far as I know.
<h2>Post processing</h2>
<p>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 <br>
egrep "Midway\"$" ~/maps/gnis/KY_deci >~/maps/gnis/KY_deci.Midway<br>
to select the portion of the GNIS data relevant to the Midway patch.
<p>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.
<p>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.
<p>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:<br>
drawmap -C 25 -d ~/maps/dem/9780CEL0.DDF<br>
<p>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:
<pre>
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.7147W
</pre>
This information will e needed in the next step.
<p>But first, to complete this step, convert the image to RGB using
right-click/Image/Mode/RGB.
<p>Now start another drawmap run, to produce the depth data. I used
<pre>
drawmap -h -d ~/maps/dem/9780CEL0.DDF
</pre>
Be sure to note the pixel size
this map produces, in my example x-width=376 and y-height=471 pixels.
<p>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!
<p>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.
<p>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.
<p>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.
<p>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
<pre>
drawmap -x 376 -y 471 -l 38.125,-84.75,38.25,-84.625 ~/maps/dlg/HY01LE01.DDF -o hydro.sun
</pre>
The 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.
<p>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.
<p>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.
<p>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.
<p>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!
<p>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.
<p>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.
<p>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.
<p>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.
<p>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.
<h2>Concluding Remarks</h2>
<p>If you find any of this confusing, have corrections, or other requests,
email me at jpenny@debian.org.
<p>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.
<p>
Thanks<br>
Jim Penny
</body>
</html>
|