Can anyone suggest a method by which I can produce several user-defined contour lines (from a DEM) within a single shapefile using QGIS/GRASS (2.12.x) and its plugins. Each approach I have tried has only allowed my to create contours in specific intervals, rather than at specific elevations

2 Answers 2


You can specify levels using the GRASS module, r.contour.level. It's available in the processing toolbox. You can search for it when the dropdown at the bottom of the Processing Toolbox window is switched from "Simplified interface" to "Advanced interface".

enter image description here

The "List of contour levels" parameter takes a comma separated list of elevation levels.

Here is the documentation for the GRASS command r.contours and the corresponding levels parameter.

Its use for this specific task is mentioned in this question.

  • exactly what I was looking for. I really need to spend more time investigating the GRASS toolbox. Thanks.
    – mastorey
    Commented Feb 3, 2016 at 19:43
  • @mastorey Great! So happy it helped.
    – user55937
    Commented Feb 3, 2016 at 20:57

If you make contours everywhere at some interval or set of intervals that includes all the elevations you want, you can then extract only those elevations from your whole set of contours to a new shapefile. To do that, go into the attribute table and select features by expression. Use an expression something like:

 "ID" >= 50 AND "ID" <= 75

where you replace "ID" with whatever field has your contour levels recorded. (Below is a dummy example using points and their sequential id numbers.)

enter image description here

Then, simply save those selected contours as their own layer by right-clicking them in the Layers Panel, and selecting "Save As," and making sure you choose only the selected layers.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.