3

I want to convert vector contours to a DEM. From other posts, I wanted to use the Grass r.surf.contours tool.

Initially, I converted the vector contour layer to a rasterized contours using the rasterize (vector to raster) tool. The contours rasterized well but there was 0 values between them.

I have tried the Grass plugin but it isn't giving me good results. I suspect it is because of the 0 values.

How do I strip these out?

  • 1
    It looks like it's trying to convert lines to raster, you need somehow to triangulate it to a surface and then export that to a raster. Normally between contours spot elevations are included; you're not going to get a good surface from contours alone. – Michael Stimson Aug 21 '14 at 0:14
  • I think that what you are missing is the "type=line" option when you run v.to.ras – radouxju Aug 21 '14 at 5:38
  • Is it possible to use this flag from QGIS processor? I didnt see that option in the dialog, even under advanced. I am using QGIS 2.4.0. – boberdorf Aug 21 '14 at 6:07
  • Actually I simplified the contours, and then "rasterised" it. Perhaps the file was too large. The resulting surface looks good, but there are many "gaps" in it with zero value. Is it possible to remove these, or determine the level from the adjacent cells? – boberdorf Aug 21 '14 at 6:47
5

You don't want to "convert" vector contours to raster format: that would merely create a raster whose values designate which contour crosses each cell (and ought to have null values in cells not crossed by contours).

To convert a set of contours to a DEM you need to interpolate the values from the contours into the regions between and around the contours. According to the current GRASS manual, the proper procedure is r.surf.contour. It's a crude algorithm: using a vector contour dataset that has been converted to raster (as described in the question), it linearly interpolates between the nearest points found on the two contours immediately surrounding each cell. This process lops the tops off all peaks, fills lakes, flattens ridges and valleys, and tends to create partial step-like surfaces. (Think of an irregular staircase at the beach onto which a lot of sand has been blown: the edges of the steps are the contour lines and the sand fills the spaces between them.) Wherever the contour lines are closely and evenly spaced this will do a good job, but the results elsewhere may look less than satisfactory.

Other options

  • Better ways to interpolate directly between vector contour lines exist, such as the related technique I described at http://forums.esri.com/Thread.asp?c=3&f=39&t=102418&mc=20#288514. It uses multiple transects through each grid point to select neighboring contour locations and applies polynomial, rather than linear, interpolation to their values.

  • As Michael Miles-Stimson answered in a comment, you can apply techniques to triangulate the contour nodes and interpolate across the triangles. These sometimes work, but they will fail to capture peaks and valleys correctly (unless you have separate data to locate them, in which case triangulation is a singularly useful method) and their results will depend on the density of nodes used to represent the contours.

  • If you have access to ESRI software, use Topo To Raster. This automatically uses a combination of methods (including triangulation and some hydrological techniques) to produce interpolations that are physically realistic.

  • Another option is to use kriging with variable support--but that's an extremely specialized procedure that I believe is available only in expensive proprietary software used in the resource discovery and extraction industries (oil and mining).

  • It looks like your Esri forum link is dead. – hfisch Sep 6 '17 at 22:24
  • @hfisch Yes, ESRI does that periodically. This won't be the last time they destroy or hide user contributions. When I provided the link they had archived the old forums and I had (perhaps naively) hoped they would continue to make the archive accessible in the same location. It looks like you have to contact ESRI tech support with specific requests: see the thread at geonet.esri.com/thread/182094-please-restore-arcscripts. – whuber Sep 6 '17 at 22: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.