[GIS] Creating DEM from vector contours using GRASS and R

contourconvertdemgrassr

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?

Best Answer

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).

Related Question