We get a lot of requests for contour maps. The issue with automatically generating contour maps is that there is no way to do so without making a lot of assumptions about what the user wants. Contour interval, coloring and what the contours are displayed over are all things that need user input.
Making a contour map based on the DEM that Maps Made Easy generates by default is both easy and fun and allows for all sorts of customization. But beware... You might have to learn something!
In this example we will make a contour map with black isoelevation lines every .5 meters and some customized coloring like this:
The data we are working with here is the sample DEM that is generated with our sample data set.
First, you will need the Quantum GIS (QGIS) software which is free. Download it from QGIS.org and install the latest version.
Next, you will need to download the DEM GeoTiff from your Map Detail page.
Open QGIS and open the DEM. To do this, go to the "Layer" at the top, select "Add Raster Layer" and select your DEM file. A "Raster" just means a pixel-based image.
Now your DEM GeoTiff will be shown in the main window. The lighter the area, the higher the elevation of that area.
Now open the Properties for the DEM by right clicking on it in the "Layers" panel and selecting "Properties".
To do the custom coloration choose the "Style" menu on the left of the "Layer Properties" dialog window and do the following:
- Change "Render Type" to "Singleband pseudocolor"
- Choose a color map in the "Generate new color map" section. "Spectral" is the default.
- Press the "Classify" button. This will fill the colors and values in on the left.
- Hit OK.
After changing the color map the image will look like this:
To add the contour lines we will open the "Raster" menu at the top and select "Extraction" and then "Contour".
The Input file will already be selected. Fill in a name for the "Output file for contour lines" and edit the "Interval between contour lines" to .5 (or whatever you want). Hit OK a few times and it will generate a shapefile that contains the contour lines.
Now contour lines will be shown at the prescribed interval but the coloring will be a random color.
To change the coloring of the contour lines right click on the newly generated layer in the "Layers" panel and select "Properties".
On the style screen click the color selector and select black. Hit OK.
Here is what the final product will look like.
the QGIS link does not work
Great article. Thanks very much for the detailed description!
Can you add contour lines in QGIS to a true colour map instead of a colourized elevation map?
Does not work as described with latest QGIS 3.0.3
@ Bruce Filmore
It still works for colorizing the raster. The dialogs are a little different than in v 2.
I could not get 3.03 to generate the contour lines though. So I repeated the process in v 2.18, exported the contours as a .shp file (which took seconds) then imported the .shp into v 3.03 no problem. I suspect QGIS will get the contour problem fixed at some point.
Great article, works well in QGIS. I accomplished these steps on a DEM raster file from a friend.
BUT where does the ELEV (Z) data come from? His file had Z values but they did not resemble elevations at all. They might have been drone height above the launch point?
How can we get true ASL elevations in the DEM?
Thank you . . . .
Someone knows how to make it in the 2023 version 3.32?
merci beaucoup ca m'a apporté un plus je suis vraiment content