This page describes how to make topographic 3D VRML
model from public available data with free tools under linux.
Motivation
My friend, Daniel, once showed me a jpeg image file that had the
terrain around the hiking trail we had visited before. It was
very impressive. I thought he generated it by a free program (3DEM?)
under Microsoft Windows. Since I was interested in data visualization technique
for my research and as a personal hobby, I tried to use data visualization tools
under Linux to produce similar images and VRML models.
I use VTK,
which is fantastic and powerful tool, to generate 3D VRML topographic model.
A convenient place to download is at
TerraServer.
We should also get the UTM
coordinates of the map download from the server. For example, when I downloaded the
DRG map for Yosemite Valley,
I also have to get the "world file".
Digital Elevation Model(DEM)
Free DEM download in SDTS format can be found at
GEO Community.
It is possible to find which map to download from
USGS Find Maps.
Sometimes, the place interested might not be covered by only one file,
in this case, it is necessary to download all surrounding area and stitch them later.
For example, I need to download 6 files to cover
the Yosemite Valley.
Preprocessing Data
Find UTM Coordinate
To proper aligning the DRG and DEM data, it is essential to figure
the UTM coordinate for both the DRG and DEM files.
Depending the source of DRGs and DEMs, there are different ways to
get the UTM coordinate. If you download the DRG file from
TerraServer,
you can get the UTM coordinate and how many meters each pixel presents
in the "world file."
For SDTS files, PullSDTS
can report their UTM coordinates and
the resolutions per pixel.
Pull out the raw data from SDTS
It is very convenient to use
PullSDTS
written by Bill Allen to extract the DEM information inside SDTS files.
Save the file in raw format (Use "Mac" byte order for 16 bits format)
and use an editor to add simple head lines (for example,
"P5 381 437 65535 ") to convert the raw files into
pgm format
(examples) that
imagemagick can convert them
into bigmap format files. With the
bitmap format files, we can stitch them with gimp (like this
file "yosemite_compose.xcf").
Output the stitched file in pgm format
(yosemite_compose.pgm).
The next step is to crop the DEM image in pgm format to fit
the DRG file with the program "pnmcut" and the known UTM coordinates
and resolutions.
Scale the DRG file
Now, re-scale the DRG file with imagemagick or other tools to
fit the size of the DEM pgm file and save it as
ppm format. We should have two files with the same size.
With the proper aligned DRG and DEM image files, this script,
Topo3D.py, can build the 3D model from the
DEM data and overlay the DRG on it with VTK 4.0 library.
The VRML file generated by Topo3D.py can be rendered by
vrmlview.
You can also use vrmlview to output snapshot as jpg file.
For example,
this gallery shows
the snapshots of the 3D models I made.