Overlay Contour Lines
This topic describes how to display contour lines on a single-band raster layer with the New Contour Layer menu option.
This option provides a quick display of contour lines in the current view, whereas the Generate Contour Lines tool (available in the ENVI Toolbox) creates contour lines at full resolution and saves them to a shapefile.
With the New Contour Layer option, all of the lines will have the same color, style, and thickness. Contour lines can only be displayed on raster layers that have not been reprojected in the view. If contour lines are displayed and the base projection of the view changes, the contour lines will be removed.
Follow these steps:
- Open and display a single-band raster such as a digital elevation model (DEM) or any dataset where you want to categorize the data with contour lines.
- Right-click on the raster layer and select New Contour Layer. An initial set of contour lines is displayed.
- Contour line properties are displayed beneath the Toolbox in the lower-right corner of the ENVI application. Here you can update the contour line properties on a case-by-case basis in the current ENVI session. The properties are described below.
Tip: These properties are also available as preferences that you can set for all contour lines that are displayed in subsequent ENVI sessions. Select File > Preferences from the ENVI menu bar. In the Preferences dialog, expand the Annotations folder and click Contours.
To create a screen capture of a raster layer with contour lines, use the menu items described in the Chip to View topic.
Set the Level of Detail Property
Displaying full-resolution contour lines on a raster layer can potentially take a long time, depending on the size of the raster layer. To circumvent this, a reduced-resolution version of the raster data is used to display contour lines. Use the Level of Detail (pixels) property to set the size of the reduced-resolution raster data. This does not modify the original data; it only defines a reduced-resolution image that is used internally to approximate the contour lines.
The default value is 1000, which means the maximum X dimension will be 1000 pixels. The Y dimension will resize accordingly. For example, if a raster has a size of 24,000 x 48,000 pixels, the resampled version will have a size of 1,000 x 2,000 pixels.
Higher values will result in longer display times for contour lines. Experiment with different values to see how they affect the resolution and accuracy of the contour lines.
To create contour lines from full-resolution data, export the contour lines to a shapefile or use the Generate Contour Lines tool.
Set Level Properties
ENVI determines reasonable estimates for default values of the first two properties below, based on the minimum and maximum values of the raster data. You can change them as desired:
- Starting Level: Set the minimum data value for plotting contour lines.
- Level Increment: Set the data value increment for which contour lines will be plotted. For example, a value of 20 for a DEM layer means that contour lines will be plotted every 20 meters, based on the specified Starting Level and Number of Levels.
- Number of Levels: Set the number of contour levels. The default value is 10.
Set Contour Properties
Update the following properties:
- Contour Color: Choose a color for the contour lines.
- Contour Thickness: Set the thickness, in pixels, for the contour lines.
- Contour Linestyle: Choose a line style for the contours.
Set Label Properties
Update the following properties:
- Show Labels: Set this property to True to display labels for contour lines. The default value is False.
- Label Font Name/Style/Size: Set the text properties of the contour labels.
- Label Interval: Set this property to a relative value between 0 and 1. The default value is 0.25. The value determines how frequently a label occurs on a given contour line. The smaller the value, the more labels you will get.
- Label Threshold: Define how long the contour needs to be in order for labels for display. This property uses a relative scale, from 0 to 1. The default value is 0.25, which means if the longest contour in the image is 1, a different contour line would need to be 25% of that length in order for labels to display. The larger the value, the fewer lines will be labeled.
Export Contour Lines to a Shapefile
Exporting contour lines to a shapefile offers the following benefits:
- The resulting contour lines in the shapefile are derived from the full-resolution raster data. Exporting to a shapefile is a good option for large, high-resolution rasters.
- You can assign colors and symbology to discrete levels of contours in a shapefile.
- Shapefiles that contain large numbers of contours display quickly and efficiently in ENVI.
Right-click on a contour layer in the Layer Manager and select Export Layer to Shapefile. The resulting shapefile is displayed in the view.
See Also
Generate Full-Resolution Contour Lines, Vectors