Wednesday, December 29, 2010

Creating Custom Topographic Maps for your Hand Held GPS Unit - Part 3

This is Part 3 of a multi-part series on creating custom topographic maps for your hand held mapping GPS unit. For previous posts click one of the following:
Creating Custom Topographic Maps for your Hand Held GPS Unit - Part 1
Creating Custom Topographic Maps for your Hand Held GPS Unit - Part 2

Creating Custom Topographic Maps
for your Hand Held GPS Unit - Part 3
Manipulating Topographic Data


In the last post, Post #2, we downloaded topographical data from the USGS Seamless server. The data we downloaded is in the GeoTIFF format, and while it looks pretty cool, we need to convert that from a shaded picture to contour lines.

Pretty groovy, but you can't go orienteering with it.

To change that mess up there into contour lines we are going to use the FWTools software that we installed way back in Post #1, so please keep reading after the jump.


Access the FWTools Shell program by going to Start -> All Programs -> FWTools. You should get a screen that looks like the following:

Ooooh, a shell!
Now with this program we are going to do four things:
  1. Convert the GeoTIFF file from meters to feet.
  2. Create minor elevation lines in 20' increments.
  3. Create intermediate elevation lines in 100' increments.
  4. Create major elevation lines in 200' increments.


Remember in the last post when I said to download the elevation data to a convenient location on your computer? Well this part is the reason why. In the FWTools Shell we are going to run a gdal command to process the GeoTIFF file and create a shapefile with elevation lines. The basic format for the gdal command is as follows:

gdal_[*] <options> (Path to Input File\Input File) (Path to Output File\Output File)

You will need to enter the full path for both the input file and the output file every time you run the gdal command. I like to create a working directory off of the C Drive called TMP. This is the directory into which I downloaded the zip files from Seamless. Make sure to unzip the files into their own directories in \TMP before you proceed.

Because this command, and the other gdal commands that I will run, are so complex yet similar, I have created a text file with the basic format of the commands in it. I simply modify the commands for the particular file I am working on and then copy and paste the command into the FWTools Shell program. You can download my text file here.


Our first step will be to use the gdal_translate command to convert the geotiff from meters to feet. To accomplish this I will use the following command:

gdal_translate -scale 0 0.3048 0 1.0 c:\TMP\02167919\02167919.tif c:\temp\02167919\02167919-ft.tif



I now have a file called 02167919-ft.tif located in c:\temp\02167919\

After converting the GeoTIFF to feet, we are now able to run the gdal_contour commands to create our contour line shape files. (Make sure to create your output directories under the \TMP directory first.) For this next step we will use three different gdal_contour commands:

gdal_contour -a elev -i 20 c:\TMP\02167919\02167919-ft.tif c:\TMP\output\02167919\02167919-20ft.shp

gdal_contour -a elev -i 100 c:\TMP\02167919\02167919-ft.tif c:\TMP\output\02167919\02167919-100ft.shp

gdal_contour -a elev -i 200 c:\TMP\02167919\02167919-ft.tif c:\TMP\output\02167919\02167919-200ft.shp

The results.
We should now have three shape files, one for 20' contour lines, one for 100' and one for 200'. Repeat this process for each GeoTIFF file that you downloaded from Seamless.

In my next post I will explain how we can create a map using GPSMapEdit and incorporate both our hydorgraphic data and our topographic shape files. Stay tuned!

~Occasional Hyker

No comments:

Post a Comment

Feel free to leave a comment. Please do not leave any obscene, profane, pornographic, incorrigible, rude, crude, very off-color, hate filled, flame war inducing, nihilistic, holistic, racist, sexist, ageist, or any other kind of -ist message. Any comments containing any of the above elements will be deleted, unless I find them particularly funny.

Thank you,
The Management