In this example we use the Contour transform template in the Transform pane for images to create a drawing with vector areas showing height contours at desired altitude steps. We color the areas using the attribute fields automatically created by the template. Next, we apply a similar procedure using the Contour transform template to create a drawing with vector lines showing height contours at the desired intervals.
We start with a raster image that was imported from an ASTER terrain elevation data set showing heights of terrain near Mount Hood, a volcano in Oregon in the United States which last erupted in 1782.
A single number for each pixel, that is, a single channel, specifies the height at that pixel. The terrain elevation may be visualized by using the height values as either grayscale color values or an index into a palette.
We can use the Style pane to see both the current coloring of the image as well as the lowest and highest elevations. Comparing the numbers to what we know of the heights of mighty stratovolcanoes in the American Northwest, we can see the data set gives heights in meters.
With the focus on the map window, in the Transform pane we choose the N45W122_dem image and the Tile field, and we double-click the Contour template to launch it.
In the Contour template, we choose channel 0 for the Channel and area as the Output type.
Based on the numbers we saw in the Style pane, we use a Start of 0 and an End of 3300. As an alternative, we could have pressed the Full Range button to load the Start and End boxes with the lowest and highest elevations in the raster.
We enter 300 as the Step. There is no need to check the Round start and end to step box, since the Start and End values we manually entered align to an even number of steps of 300 meters each. However, if we had pressed the Full Range button, then it would make sense to check the rounding box.
We check the Split into shapes box, so that all the various contour areas will be created as separate area objects in all regions for similar contour values. Unchecking this box creates a single, multibranched area object for each contour interval.
For the Result destination, we choose New Table and then enter Contour areas as the name of the new drawing. As we enter the name for the drawing, the pane will automatically fill in an analogous name for the table. We can change that if we like. We could use whatever names we want for the names of the new drawing and table, but it is wise to use names that remind us of what they are supposed to be.
If we would like to see a preview, we press the Preview button. We do not have to do a preview before applying a transform, but taking a moment to check our setup with a preview can be a great way to avoid errors, such as creating contour areas when we wanted to create contour lines, or vice versa.
A preview appears in blue preview colors, in a virtual layer above all other layers and contents in the map window. A blue preview caption bar appears at the top of the window giving the name of the template being previewed. We can right-click the caption bar for a menu of choices to control the preview display.
For example, if we would like to see layers below the preview, we can right-click the caption bar and choose 50% opacity to render the preview with partial opacity, so what is below can be seen.
We can right-click the caption bar and choose Left or Right to show the preview only on the left or right side of the window, dragging the thin blue vertical separator line left or right to adjust the width of the preview.
If we like what we see, to apply the template we press Transform.
Almost instantly, a new drawing called Contour areas appears in the Project pane. We drag and drop the new Contour areas drawing into the map as a layer.
Dragging and dropping the new drawing into the map, we can color it using Style to show the areas it contains, as seen above right. The illustration at left above shows the original terrain elevation raster.
The illustration below shows the Style pane settings used to color the Contour areas drawing.
The style uses a thematic format based on the ValueMax attribute for the fill color for the body of the areas, and a very dark, almost black, gray color for the area boundary line. We use the ColorBrewer CB Spectral palette, with reverse ordering of colors.
We can zoom into the region immediately around Mount Hood to see the detail of contours. At right we see the original raster, with the view in the same location.
Next, we will use the same template to create contour lines.
We start with the same raster image, showing terrain elevation in the vicinity of Mount Hood.
The Transform pane is still loaded with the parameters we used when we created contour areas. That is very convenient for repeating the operation, but for lines.
In the Transform pane, in the Output type pull down menu we choose line. Next, for the name of the New drawing for the result destination we change the name to Contour lines, with a corresponding name for the New table.
All other parameters we leave the same, since we are simply creating the contour line equivalents of the contour areas we created in the prior example.
In particular, we leave the default Split into shapes option checked, which creates independent line objects for the same contour line value. Unchecking this box creates a single, multibranched line object at each contour value. Leaving the default Split into shapes option checked also has the advantage that if any of the created lines exceeds 64 million coordinates ( ... a big line...), Manifold will automatically split it into more than one line so that each stays less than 64 million coordinates in size.
Press Preview to see a preview.
The preview shows the contour lines that will be created.
If we would like to see just the preview, without the background N45W122 layer, we double-click the N45W122 layer tab to turn that layer off.
Press Transform to apply the template.
Almost instantly, a new drawing called Contour lines appears in the Project pane. We can drag and drop it into the Map to compare it with the original raster.
The original raster layer is seen at left above. At right above, we see the Contour lines drawing using the Style pane thematic format shown below. The illustration at right above also has had an ESRI server background layer added, the Canvas Dark Gray background map, to provide a contrasting dark background to enhance visibility of the contour lines.
The thematic format for lines is similar to the thematic format shown in the areas example above, again using the CB Spectral palette in reversed order.
Zoomed in to Mount Hood, we can see the details in the contour lines.
Contours provide comprehensible displays when we use them with restraint. Too many contour lines at too small a step can decrease understanding. We can see what happens if we create contour lines at 100 meter intervals for this particular data set.
In the Transform pane, we change the Step to 100, and the name of the New Drawing to Contour lines 100, with a corresponding name for the New table.
Press Transform.
A new drawing called Contour lines 100 and a corresponding table appear in the Project pane. We drag and drop the Contour lines 100 drawing into the map, and then we use the Style pane to apply the thematic format shown below.
The thematic format approximates the unique values format used earlier, but this time using 12 breaks of equal intervals for the contour Value, applying the CB Spectral palette in reverse order.
The Contour lines 100 layer is seen at left above, with the illustration at right above showing the Contour lines layer, which has contours at 300 meter intervals. The 100 meter contour lines at this zoom level are on the edge of being too busy.
Suppose we would like to create contours on custom intervals, that is, not on intervals with an even step between each interval? That is easy to do, and illustrated step-by-step in the SQL Example: Custom Contour Intervals topic.
Trace Vector Areas from Raster Pixels
Contour a 300MB DEM in Five Seconds
Example: Tanaka Contours - Also known as illuminated contours, Tanaka contours give the appearance of three dimensionality to contour lines by brightening lines on a slope facing a presumed light source while darkening lines on a slope facing away from the light source. Lines are also made wider when perpendicular to the light source. This topic shows how to create the Tanaka effect in contour lines.
SQL Example: Custom Contour Intervals - This example builds on the Example: Contour Areas and Contour Lines topic, using the Edit Query button in the Transform pane for images to learn how to slightly alter the generated SQL to create contour areas or lines on whatever intervals we like, and not just evenly spaced intervals like the default transform creates. It's incredibly easy.
Example: Flooded Roads - We consider a hypothetical case of a 10 meter rise in sea level in the San Francisco Bay area, and we find what highways and major roads would be flooded by such a rise. The example uses both raster and vector data sets, combines a number of techniques and uses the Contour, Buffer, Merge, and Clip transform templates.
Example: Trace Vector Areas from Raster Pixels - This example follows the Trace Vector Areas from Raster Pixels video on the Gallery page. We use the Trace Areas template in the Transform pane for images to create a drawing with vector areas covering regions of similarly-colored pixels. Next, we use a simple query to add classification codes from a USGS table of classes to the resulting drawing, using a simple INNER JOIN SQL statement.