Hack 53. Visualize Your Tracks in Three Dimensions

With free Windows software and a little tweaking, you can make nice 3-D models of your outdoor perambulations.

Wouldn't it be nice if you could get a better feeling for the terrain you just crossed or the magnificent view you saw earlier? Wouldn't you like to be able to do something with all of those tracklog files you've been collecting?

Wissenbach Map3D is a GPL-licensed Windows application that reads tracklogs in GPX format and then plots them over aerial photos and three-dimensional terrain models. 3DEM is a Windows program that allows you to quickly explore elevation models in many different formats and to overlay images on these terrain models. You can also export views and terrain models, and create fly-by animations. One of the best parts about it is that it "just works" to open and display digital elevation model (DEM) files.

5.9.1. Loading the Example

Wissenbach Map3D is available at http://www.gpstrailmaps.com/map3d/. Download http://www.gpstrailmaps.com/map3d/SetupYosemite3D.exe to get a copy of the program with sample data from Yosemite National Park in California.

Following the instructions in the Readme file, you can open the sample GPX file by going to the File menu and selecting Yosemite.gpx. A Map Description dialog will load; you can just click OK. Wissenbach Map3D will then attempt to fetch the aerial photography for Yosemite from Microsoft's Terraserver service so you'll need to be connected to the Internet. When it's done, you should see tracklogs and waypoints from that GPX file displayed over the aerial photography. Neat, huh? You ain't seen nothing yet!

Now, click the 3DMap option from the menu bar at the top, which loads the Scene Properties dialog. Although we recommend experimenting with this on your own, for now just click OK. The program will take a minute or so to render the scene, and then it will display a 3-D model of Yosemite Valley! You can then "fly through" the Yosemite Valley by selecting Camera Mode images/ent/U2192.GIF border=0> Slide. Navigate through the valley by dragging the mouse. Figure 5-9 shows one view of the sample track snaking up the side of the valley. Speaking as one who has spent time navigating that valley on foot, using the mouse is much quicker!

Figure 5-9. The Yosemite Falls trail shown in Wissenbach Map3D

 

5.9.2. Loading Your Own Data

Once you tire of exploring Yosemite you can load Digital Raster Graphics (DRGs) and Digital Elevation Models (DEMs) for your own area. Since sources of data vary, you'll want to follow the instructions provided by the source's web site.

Once you start the program, you need to set an "area of interest." You can do this in one of three ways. Select View images/ent/U2192.GIF border=0> Pick Center to manually enter a point to be the center of your map. Alternatively, you can connect a GPS to your system and read points directly, or you can load a waypoint from a GPX file.

If you open a GPX file, the program will fetch aerial photos or topo maps from Terraserver and plot your tracklog over the image, once you're zoomed in close enough. You can select a USGS topographic base map (i.e., a DRG) with File images/ent/U2192.GIF border=0> JPG Topo Basemap, or an aerial photo base map with File images/ent/U2192.GIF border=0> JPG Photo Basemap. Figure 5-10 shows a GPX tracklog from Black Rock City, Nevada laid over an aerial photo automatically downloaded from Terraserver.

Figure 5-10. A tracklog from Burning Man shown over an aerial photo

 

5.9.3. Loading New Elevation Models

Wissenbach Map3D uses USGS DEM files, each of which covers a seven-minute named quadrangle (about 8 miles by 6.5 miles) at a resolution of one arc second (~30m) or one-third arc second (~10m). The 30-meter DEMs are plenty good enough to experiment with at first, and they involve downloading a lot less data than the 10-meter DEMs. Later, if you really get into playing with digital elevation models, you can go back and get the 10-meter DEMs.

The GeoCommunity's GIS Data Depot hosts free DEM data sets for the USGS at http://data.geocomm.com/dem/demdownload.html. The DEM files are organized by state and county. To figure out exactly which quadrangles you'll need, though, you can search the USGS Geographic Names Information System (GNIS) by place name at http://geonames.usgs.gov/. Alternatively, you can search for quad names on an interactive map by visiting the USGS Geospatial Data Availability site at http://statgraph.cr.usgs.gov/. Once you find the quads you want in the GIS Data Depot download listing, you'll notice a seven-character unit code like 38122f7 in parentheses next to the quadrangle name; make a note of this, because you'll need it later.

The seven character USGS quadrangle unit codee.g., 38122d7identifies the location of the quadrangle. The letter d implies that the upper left corner of the DEM will be approximately 71/2 minutes x 4 units = 30', or 0.5º north of 38º N. Likewise, the number 7 means that the same corner will be 71/2 minutes x 7 units = 52.5', or 0.875º west of 122º W.

At this point, you should be able to download one or more compressed DEM files from the GIS Data Depot. Unfortunately, these datafiles are in the much-reviled Spatial Data Transfer Standard (SDTS) format, so we'll have to convert them back to the USGS's native DEM format for Wissenbach Map3D to make use of them. Start by extracting the DEM from the TAR.GZ archive using WinZip, or any archive utility of your choosing. The names of the .DDF files inside will start with a four-digit number, like 8505. Make a note of this as well.

Next, fetch the sdts2dem utility from http://www.cs.arizona.edu/topovista/sdts2dem/ and simply run it from the DOS command line. You'll see a series of prompts as follows:

Enter first 4 charcters of the base SDTS file name: 8505
Enter base output file name (exclude any extension): o38122f7

Enter in the four-digit SDTS filename prefix, followed by the USGS quadrangle unit code prefixed by the letter o. You should be able to copy this into your Wissenbach DEM directory, which is defined under File images/ent/U2192.GIF border=0> DRG, DEM Directories. Wissenbach Map3D should now be able to make use of your new elevation models.

If you happen to have GDAL handy, the following gdal_translate command might work for you instead of having to use sdts2dem:

gdal_translate -of USGSDEM 8505CATD.DDF x38122f7.dem
 

See [Hack #68] for more details.

Wissenbach has stated plans to extend the program to use elevation data loaded from [Hack #67], which would make this process a whole lot easier, so stay tuned.

5.9.4. Adding Elevation to a Tracklog

In addition to providing nice visualizations, Wissenbach Map3D solves the tricky problem of adding elevation data to a tracklog. While many modern GPS units log elevation as you go, others do not. You can get the elevation of your track points ex post facto by using Perl, Python, or perhaps a bit of GRASS to look up the elevation of each point in a slew of DEMs, SRTM data, or GTOPO30, etc. This involves enough scripting and tedium that it almost isn't worth documentingat least now it isn't, since Wissenbach Map3D solves the problem with a nice GUI!

The program allows you to load tracklogs from GPX files, and it also allows you to create GPX files by drawing over the map in the display window. You can then add altitude to the new or loaded tracklog.

Select a "Trail" (e.g., a tracklog) with Edit images/ent/U2192.GIF border=0> Select Trail, and then click on the tracklog. Then select Trail images/ent/U2192.GIF border=0> Trail Properties. Click on the checkbox labeled "Ground Trail to DEM Elevation," and then click OK. That is all you need to do. Assuming you have loaded the proper DEMs, the program will add elevation to your tracklog. You can now select File images/ent/U2192.GIF border=0> Save to save this tracklog with elevation data included and use that tracklog in other programs that use elevation.

5.9.5. Hacking the Maps

Since DRGs are images in TIFF or JPEG format, you can edit the images and create your own views of the data. Download a DRG that covers your area, make a copy of it, and then load it into an image editor, such as Photoshop or the GIMP. If you save your customized image in a PNG file, you can retain the original DRG as the TIFF image. Alternatively, create a new layer, set the opacity to 50%, and use the base layer as a guide to your own creation!

5.9.6. Three-Dimensional Terrain Models in 3DEM

While Wissenbach Map3D is great at combining tracklogs and elevation models, it can be a bit of a challenge to work with if all you want to do is render 3-D scenery. For that, try 3DEM, a fantastic piece of free software for Windows.

3DEM has some features in common with Wissenbach Map3D, but Wissenbach assumes that you know where you want to explore and that you have already downloaded the relevant elevation data. This makes Wissenbach more "transparent" at letting you follow a tracklog, while 3DEM is much easier to use to explore the DEMs that you have downloaded.

3DEM can be found on the Web at http://www.visualizationsoftware.com/3dem.html. The download page includes links to digital elevation models (including DEMs of Mars!) and a helpful tutorial on finding additional DEMs on the Web.

3DEM has other features, including the ability to save virtual-reality markup language (VRML), save worlds, create fly-by animations, and it can even be used to orthorectify ground images.

Like Wissenbach Map3D, you can load tracklogs into 3DEM for display on the map. A nice feature is that if you do not have the altitude for your track points, it will be automatically added when you save the file. The downside is that 3DEM is a tad particular about the tracklog format it will accept. The 3DEM tracklog format is simple:

lat long elevation

But if you don't have an elevation you must include a 0 for your elevation field. This makes it a bit harder to load your own tracklogs. If you have gpsbabel [Hack #51] , you can convert your GPX format tracklogs to 3DEM format using this gpsbabel stylesheet. Save this as 3dem.style:

FIELD_DELIMITER WHITESPACE
RECORD_DELIMITER NEWLINE
 
OFIELD LAT_DECIMAL, "", "%08.5f"
OFIELD LON_DECIMAL, "", "%08.5f"
OFIELD ALT_FEET,"","%.0f"

You can then convert your GPX-format tracklogs to 3DEM format with this command, and then you can see your tracklog over an elevation model, as shown in Figure 5-11.

$ gpsbabel -t -i gpx -f yourfile.gpx -o xcsv,style=3demstyle 
-F your3demfile.txt

Figure 5-11. Tracklog over an elevation model from 3Dem

While it is a basic principle of geography that terrain shapes human behavior, it was still a surprise to me to see the image in Figure 5-11 and to again get the lesson! Transportation geography is a fascinating subject. I've spent a bit of time studying the Transport Geography page at http://www.geog.umontreal.ca/Geotrans/.

Mapping Your Life

Mapping Your Neighborhood

Mapping Your World

Mapping (on) the Web

Mapping with Gadgets

Mapping on Your Desktop

Names and Places

Building the Geospatial Web

Mapping with Other People



Mapping Hacks
Mapping Hacks: Tips & Tools for Electronic Cartography
ISBN: 0596007035
EAN: 2147483647
Year: 2004
Pages: 172

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net