------------------------------------------------------------------------------- TopoVista ------------------------------------------------------------------------------- Will Evans and Gregg Townsend Department of Computer Science, The University of Arizona topovista@cs.arizona.edu http://www.cs.arizona.edu/topovista/ ------------------------------------------------------------------------------- TopoVista uses a RTIN (Right Triangular Irregular Network) hierarchy to provide an interactive 3-D perspective view of digital elevation models. Each view is based on an approximation to the original model. The approximation is sensitive to the current eye position, so that portions of the terrain that are close to the eye are more closely approximated than those farther away. This reduces the number of triangles that need to be rendered for each frame and makes interactive response possible. The elevation model can be false colored by elevation or colored using a PPM file which is an optional argument to the TopoVista program. The PPM file is created from a U.S. Geological Survey CTG file using the program ctg2ppm (see Other Functions below). The digital elevation model used by TopoVista is created from a U.S. Geological Survey DEM file using the program dem2dm (see Other Functions below). The program comes with a sample digital elevation model and PPM file covering the San Francisco area. To try out the program, build it (see the INSTALL file) and then: 1. Type 'dem2dm sfnorth.dem > sfnorth.dm' to convert the DEM model to a DM model. 2. Type 'topo sfnorth.dm sfo.ppm' The program will print the dimensions of the data files it's reading. ppm size 442 x 279 grid size 370 x 465, dimensions 11 x 14 km, elevations 0 to 343 m Then three windows (the Control window, Overhead window, and Perspective window) will appear. If you're in the Overhead (2-D, relief) window, dragging the mouse around with the left button down changes your eye position. Dragging with the right mouse button down changes where you're looking. The lines (shaped like a V) in the Overhead window indicate your field of view. Try holding the left mouse button down and going outside the window. If you click the middle mouse button, the current position and elevation are printed on the standard output. The Control window (that's the one with all the text) has various options to play with. You can left or right click on the options and they change value, or you can type the letter in brackets (in any window) to do the same thing. [C]olor by It cycles through 2 or 3 possible colorings of the terrain. The first is PPM file coloring. In order to have this option you have to give the program a ppm file. The second is a false coloring based on elevation. The third is some sort of metallic lead-like color. [R]efine by Threshold[+/-] As you probably guessed, the program approximates the surface using a set of triangles. It changes the approximation when you change your position or the point you're looking at. Parts of the surface that are far away from you are approximated less precisely than parts that are closer. The "[R]efine by" option allows 3 possible methods of performing the approximation. All three are based on the "error" of an approximating triangle. Imagine a flat triangular sheet of metal whose three corners are nailed to the surface of the earth. In between, it either lies above the surface or below the surface (it's flat, the earth is bumpy). The error of the triangle is the maximum vertical distance from the metal to the earth's surface. If this distance is too big we should use two triangles in place of the current one -- the current one is too "coarse", it should be "refined". Refine by Distance uses two measures of coarseness, A and B. (A) involves triangle error (e) and distance (d) from the triangle to you. If e/d is big then the triangle is too coarse. (B) involves triangle size and distance. If the triangle is big and d is small then the triangle is too coarse. Threshold, in the Refine by Distance case, determines what "big" and "small" mean in measure B. Refine by Heap orders all triangles using measure A. It takes the n worst triangles where n is the Threshold value in this case. Refine by Error uses measure A. The Threshold value determines how big e/d must be before the triangle is too coarse. [E]ye Up means the perspective view is from a position far above the surface of the earth. Down means you're walking on the surface. PageUp and PageDown also control the eye. [2]d Mesh The triangles used to approximate the surface can be shown in the top down window (the 2-D window) by toggling this option. 2-D Mesh has 3 modes Off, Outlined, or Filled. [3]d Mesh Shows the triangles in the perspective view. Only 2 modes. [D]etails Show the current perspective scene at full detail. (Try it.) [P]rint This will print a list of all the triangles on the screen -- not a lovely picture, just a bunch of coordinates -- to the standard output. Totally worthless. Don't use it. [Q]uit when you just can't take any more. There are a few options that aren't mentioned in the Control window. You can move and rotate in big steps using the arrow keys or in little steps using shift + arrow keys. You can move forward or backward in even bigger steps by pressing the Space bar or Backspace key. Command line options: -d distance threshold (for measure B discussed above) -e error threshold (for measure A discussed above) -n max triangle count (threshold for Refine by Heap) -v vertical scaling factor (default=1.0) ------------------------------------------------------------------------------ OTHER FUNCTIONS ------------------------------------------------------------------------------ 1) How do you get more digital elevation models to look at? Go to http://edcwww.cr.usgs.gov/doc/edchome/ndcdb/ndcdb.html to get some 1 degree x 1 degree DEMs (they're called 1:250,000-Scale Digital Elevation Model). You can also use 7.5 minute DEMs if you can find them. The next step is to translate them from DEM form to DM form. Use the program dem2dm to do this. This program takes one argument -- the name of a DEM file -- and produces, on the standard out, a DM file. Now run 'topo' on the newly created DM file. 2) How do you get ppm files to color the digital elevation models? Go to http://edcwww.cr.usgs.gov/doc/edchome/ndcdb/ndcdb.html to get Composite Theme Grid (CTG) data. It's under 1:250,000-Scale and 1:100,000-Scale Land Use and Land Cover (LULC). Get the file called 'grid_cell' for whatever area you'd like. The files for Arizona are at http://edcwww.cr.usgs.gov/glis/hyper/guide/1_250_lulcfig/states/AZ.html Now translate the CTG file into a PPM file using the program ctg2ppm. This program takes one argument -- the name of a CTG file -- and produces, on the standard output, a PPM file. (Yes, it's a regular PPM file. It just has some latitude/longitude stuff in comments at the beginning.) The colors assigned by the program ctg2ppm to the various usage codes can be found in the file ctg2ppm.c. Assuming you have a DM file with elevation data for the same area covered by the PPM file, you can just run: topo dmfile ppmfile If the ppmfile has no latitude/longitude information (for example, it's just a picture you want draped over the terrain) then the program assumes that its extent matches the dmfile extent. 3) How do I crop a DM file? Use cropdm to extract a rectangular subgrid of a given DM file. usage: cropdm filename [[x0 y0] x1 y1] x0 y0 South-West corner (default 0 0) x1 y1 North-East corner (default N-E corner of original) 4) I now have 8,000 DM files lying around. How can I list them to find out what they contain? Use dminfo. This program takes an optional verbose flag -v and a list of DM file names and prints out how big they are and their location in degrees of latitude/longitude. usage: dminfo [-v] [file...] -v print verbose report Normally prints grid size and latitude/longitude of two corners. With -v, prints all four corners and corresponding grid locations.