14

I want to create a DEM from depth contours (shapefile) in QGIS. I've been trying to work out how to do this based on this previous question, notably from this link from that page, however I'm stuck, and was hoping someone could help.

My progress/process so far:

  1. open new map in QGIS, import the contour shapefile
  2. set GRASS extent, set new GRASS mapfile, etc
  3. try to 'import' the shapefile into grass by converting it into a grass file, based on a hunch from the wording in this page (search in page: 'use of qgis and grass'): file management, import into grass, import vector into grass, import loaded vector (v.in.ogr.qgis), then view output. This creates an identical looking layer.
  4. try to use r.surf.contour on this - doesn't allow layer to be selected.
  5. try to use r.surf.contour2 on this - either crashes QGIS or produces a full block of colour.

Any thoughts/tips on what I should be doing differently?


Interpolation failing, tried everything in GRASS & in GRASS plugin, failed, could problem be due to source shapefile?

Something I learnt from elsewhere was 'geometry tools > check geometry validity' which I ran on the contour shapefile and it found loads of errors.

I'm wondering if this could be the reason that all my efforts to create a DEM are failing?

Would anyone do me the huge favour of having a look at my shapefile to see if I'm just being useless, or if it's a problem that a relative novice would be excused for not anticipating?

2
  • Did you try to use the intrpolation plugin? No Grass necesary... Commented May 9, 2013 at 16:46
  • Hi Gerardo, thanks for the idea. I've been playing around with it without much success. I'm using 10m contours for the whole of Ireland and interpolation doesn't seem to result in the high res i'm looking for... should I be able to get the result I need from this method?
    – dez93_2000
    Commented May 17, 2013 at 1:02

3 Answers 3

6

I used this tutorial to create a Digital Terrain Model (DTM).

It uses as input contour shapefiles converted in raster contours that are later interpolated in DTM (looks like a continuous heat map)

It is not using QGIS but just GRASS, but it may be feasible with the Grass plugin from QGIS.

4
  • The tutorial link is broken
    – MDHald
    Commented Sep 17, 2014 at 12:32
  • @PolyGeo The person who edited my post and converted my link into a hidden link missed the last 'l' of from 'html' so that now the link ends now in 'htm'. Add the l and it will work. I tried to edit my post but I could not find a way to do it. I hope that the person who edited and made the mistake can correct that. For your convenience I add it in this comment:good tutorial link
    – Bogdan
    Commented Sep 24, 2014 at 14:35
  • That was my mistake for which I apologize. I've now fixed it. You should have been able to fix it using the edit button beneath your answer.
    – PolyGeo
    Commented Sep 24, 2014 at 20:49
  • @PolyGeo Sorry, I may have not been logged in. Now I can see the edit link.
    – Bogdan
    Commented Sep 26, 2014 at 16:21
5

I use the following procedure with great success. Open "Processing" toolbox inside QGIS, click on "SAGA", click on "Raster creation tools", and finally click on "Triangulation". In the "triangulation" dialog box, select the shape file that has the data points used to create the contour. Choose the attribute field that has the elevation data, specify the cell size. The smaller the value of the cell size the higher the resolution will be. Run and the raster file will be created and loaded as a memory layer.

4

The GRASS tutorial looks like the ticket. Following along your steps, are you converting the contours to raster somewhere between 1 and 4?

Last paragraph in the About section:

A number of the r.surf.* modules want the input data to be in raster form already, so we rasterize the contour lines, using the level column for the height values. Also some of the older r.surf.* modules only like to work on integers, so to preserve sub-meter fidelity we do a little trick where we multiply by a large number, do the process, then divide by that number again (to avoid terracing be sure it's floating point, not an integer).

7
  • so the rasterisation process is where i'm probably going wrong. Should I be importing the vector into grass, or converting it into a raster first? Do I need to use the v.to.rast.constant in grass to do this, or the QGIS version?
    – dez93_2000
    Commented May 9, 2013 at 0:35
  • 3
    The procedure should be: import the contour lines into GRASS, convert GRASS vector to raster using v.to.rast.attr. Then run r.surf.contour to get the dem.
    – Micha
    Commented May 11, 2013 at 15:06
  • Micha, thanks very much for the walkthrough, that sorted it. Kinda: any tips on getting a higher res output for the raster? There doesn't seem to be such an option. See image link, with imported-into-GRASS contours (thin lines), resultant raster (red squares) and DEM from the raster (colour gradient): imgur.com/miHRcF4
    – dez93_2000
    Commented May 17, 2013 at 1:00
  • 1
    Investigate the 'Region' settings: gis.stackexchange.com/questions/15727/…
    – Barrett
    Commented May 17, 2013 at 13:19
  • Thanks Barrett, looking at that now. If you happen to know what the cell sizes correspond to off the top of your head, please lemme know! Cheers.
    – dez93_2000
    Commented May 21, 2013 at 14:24

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