Elevating shapefiles

VisIt can read ESRI shapefiles and these files typically contain vector (meaning geometric and not raster) data that describes things relevant to GIS such as the locations of roads or buildings. This page describes how to combine shapefiles and elevation data into the same visualization where both the terrain and shapes on the terrain are elevated by the height. The example used on this page draws roads from a shapefile elevated on a terrain from a DEM file.

Elevating the terrain

It is easy enough to elevate the terrain using the Elevate operator in VisIt. The Elevate operator displaces a mesh's nodes by the height values defined at those nodes, transforming it from a flat surface into a terrain. Depending on the units used for the height variable and those used for XY coordinates, it may be necessary to also add a Transform operator to do some scaling of the height used to elevate the surface. For example, some GIS datasets use degrees lat/lon for the X,Y units while using meters for height. If you did not do some conversions, you'd get a very long plot with a small cross section.

  1. Create a Pseudocolor plot of your height variable
  2. Add an Elevate operator
  3. If height units differ from X,Y units, open the Elevate operator's attributes and click on "Elevate height relative to XY limits". This will scale the elevated surface into roughly a cube shape
  4. Apply a Transform operator, turn on scaling, and set the Z scale to a value like 0.04. This value will reduce the size of the peaks to something a little less exaggerated.
2D data Elevated 3D data
Elevate0000.png Elevate0003.png

Mapping height values onto the shapefile geometry

We want to elevate the shapefile's geometry using the values from the terrain's height values. This means mapping the values from the terrain onto the geometry of the shapefile. This can be done using VisIt's CMFE expressions.

This procedure assumes you already created the elevated terrain and have just opened your shapefile. The next thing you need to do is create the expression that will map the terrain heights onto the shapefile's mesh so it too can be elevated.

shape_elev = pos_cmfe(recenter(</path/to/file.dem:height>), polyline, 0)

The above expression assumes your terrains come from a DEM file located at /path/to/file.dem and that the variable is called height. You'll need to make substitutions for your filename and height variable name. The shapefile being elevated has a mesh called polyline that consists of lines. If your shapefile has a different mesh name then you'll need to edit the expression.

After creating your expression, you can create a Pseudocolor plot of your shape_elev variable.

Mesh Height data mapped onto mesh
Elevate0001.png Elevate0002.png

Creating the combined visualization

You can follow the steps from before to create the elevated terrain. Next, you need to apply the same Elevate and Transform operators to your shape_elev data.

  1. Turn on "Apply operators to all plots" under the plot list in the Main window. This will cause the operators from the first plot to be applied to the new plot.
  2. Create a Pseudocolor plot of shape_elev. Note that the operators get applied
  3. Turn off "Apply operators to all plots" since we want to tweak the Transform operator on the new Pseudcolor plot.
  4. Open the Color table window and create a new color table that has 2 black control points so all of the color table is black. We'll use this to color the lines.
  5. Open the Pseudcolor plot attributes and set the color table to the new black color table. This will cause the elevated shapefile geometry to be drawn all black instead of in hot colors.
  6. Open the Transform operator attributes for the 2nd plot and translate the plot in Z by a small amount like 0.004. This will shift the lines forward a little over the terrain, making intersections less likely. Adjust this translation value until the visualization looks good.