In researching this I have found many references to the opposite, creating elevation data from contours, but nothing regarding contour creation. Preferably, I am looking for open source solutions like QGIS, Grass or command line tools but I am open to any suggestions that will get me pointed in the right direction.

I am planning to take the contour data into a vector drawing app for line formatting but if the app can do some of that as well it would be a major time saver.

  • 3
    did you look in qgis at the menu raster ->extraction ->contour? – Kurt Oct 23 '12 at 18:44
  • Thanks, this is about the same as Aaron's advice. It works great. – Veazer Oct 24 '12 at 1:43

If you are looking to convert DEMs to contour lines:

For converting scanned topo maps to vector contour lines, Arcscan is one of the easiest (and most sophisticated) programs out there. However, there are several opensource alternatives, including a promising GRASS approach:

Trace vector contours from a scanned map.

Additional information can be found here:

| improve this answer | |
  • Thanks, that seems to work. I love the fact the conversion can be scripted. I've got a lot of learning to do with QGIS. – Veazer Oct 24 '12 at 1:42

I think that GRASS module r.contour has more functinality than QGIS' one. For example, you can set maximum and minimum levels for extracting contours. Plus, it has parameter cut which makes the output more generalized.

| improve this answer | |

Another open source option which can easily be scripted using shell scripts or python is to use GDAL_Contour to generate contours from a dem file. I grabbed some example DEM data and ran this command to generate 10 m contours, saved as a shapefile:

gdal_contour -b 1 -a elevation -snodata -9999 ns67ne.tif contour.shp -i 10

The switches are:

  • -b 1 selects the band of the image to process, which defaults to 1
  • -a elevation is the name of the contour elevation attribute which will be created
  • -snodata -9999 tells GDAL the value of nodata cells in the input raster, so they can be ignored
  • ns67ne.tif contour.shp are the input and output files, respectively
  • -i 10 is the spacing between each contour
| improve this answer | |
  • 2
    Apparetly QGIS uses GDAL_Countor, so it's like QGIS works as frontend to GDAL_Contour. – Vladimir Oct 24 '12 at 8:02
  • I didn't know that, good to know! – sgrieve Oct 24 '12 at 8:04
  • 1
    Not only is it a frontend for gdal_contour, QGIS shows the exact gdal_contour parameters that it will run and allows you to edit them before running it. – Veazer Oct 25 '12 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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