use and abuse of elevation contours

I’d never really looked at elevation in GIS data before, mainly because the data sets are big and I didn’t understand the format. I believe that in GeoGratis, NTDB and its successor CanVec provide elevation data, but those are vector formats. Most terrain data is delivered in DEM rasters, and in Canada you can get them from GeoBase.

GeoBase DEM files come in archives containing two tiles, the east and the west. I’m not quite sure why they do this. Unless you live in an area of spectacularly interesting terrain, loading them straight into your mapping package will likely result in a large splodge of flat greyness. Because they are 2D arrays of spot heights, there’s not much variation between neighbouring points, unless you’re at a cliff.

Another issue you need to address in reading DEM files is the handling of unknown values. gdalinfo will show you the value in a line like

NoData Value=-32767

Unless you filter that value out, your DEM file will appear to have holes approximately 4x the height of Everest. This causes problems if you try to make a colour map.

Here’s the DEM for my neighbourhood, translated and cropped using gdalwarp, and false-coloured in QGIS:

Not surprisingly, Taylor Creek runs through the lowest ground (funny how water does that …). I could have picked off spot heights with QGIS’s ‘Identify Features’ tool, but contours are neater:

I made the 5m contours with gdal_contour, using the following command (on the terrain data which I’d converted to GeoTIFF):

gdal_contour -a elev -3d kennedy_park.tif kennedy_park-contours.shp -i 5.0 -snodata -32767

Looking at that map, and despite the somewhat wibbly nature of raster-vector converted contours, the elevation of my house is about 167m. My GPS – a Garmin GPSMAP 60CSx – contains a barometric pressure sensor, and on a day I’d remembered to calibrate it by the lake, it said I was at 166.9m above sea level. Neato!

Update: just to show that Canada has some wiggly bits, here are some contours for Grotto Mountain, not far from Canmore, AB:

These are 50m contours, though – 5m would just be a blur.

3 thoughts on “use and abuse of elevation contours

  1. Hi,

    Read with interest this article, I am just getting into these opensource GIS programs myself.

    You mentioned that filtering out the unknown data from the geobase dem files is important, but how do you do that?

    The other thing I was wondering is how you overlayed the false-colored geotiff image onto the canvec data to produce the image above of Taylor Creek flowing through the lower grounds.

    I have been playing with landserf performing peak classification… nifty stuff.

    Cheers!
    Martin.

  2. Hi Martin,

    You can filter out missing data with the ‘snodata’ option in many gdal programs. I’m not sure if you absolutely have to specify if your dataset explicitly contains a NoData value; some headerless/legacy formats don’t.

    I overlaid the false colour elevation data in QGis. The streetmap is from the Toporama Web Map Service. It’s really good for quick visual confirmation of local map detail.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>