Well, Today was a great day. A colleague asked, “Can I generate a DEM of my region using QGIS?” This was my answer to them “YES”. Then they asked me “How?” I ended up spending the next hour doing the demo on my laptop for them to grasp the rough idea of how to go about this issue.
That question motivated me to write this post so as to anyone out there who might be stuck in this issue like my good friend.
Here are the steps for generating a DEM (Digital Elevation Model) from CONTOURS using GRASS Plugin in QGIS (QGIS DEM)
To start, ensure you have the GRASS plugin installed in your QGIS (Plugins > Manage and Install plugins >GRASS)
Load the “Contours”vector layer in QGIS.
Go to GRASS under the Plugins Menu
Select “New Mapset”.On the Grass Database window, select the folder in which your project will be stored and Click “Next”
On the Grass location, select “Create new location” give it a name and click “Next”.
On the “Mapset” window give a name to the Mapset you are about to create and click Next
After this, the “Create Mapset window ” should display showing all the settings we’ve made. Click Finish.
A red Rectangle should be drawn on the QGIS canvas surrounding the extent in use.
Next
We need to add a Vector layer into the GRASS Mapset
Go to Grass > Open Grass Tools
The window below appears. In the “Module List” search for v.in.ogr.qgis (To import the loaded vector layer into GRASS) and click on it.
In the module “Options” tab select the “contours” layer, the Name for the output map and also the name for the new location and click “RUN”.
The progress is shown in the “output” tab. Click on the “View Output ” button to view the layer in GQIS canvas.
Results of the first module
Still on the “Grass Tools” Window, on the “Module List” tab search for v.to.rast.attr (We need to convert the vector layer into Raster) and click to launch.
Second module
Select the attribute field to be used (in this case “ELEV”)
Setting parameters
Results of second module
Now that we have the raster layer, we can now generate our DEM.
On the Module List, search the r.surf.contour (to generate DEM from the rasterized contour layer).Enter the name for the output and click ‘Run’ then ‘View output’ and Close.
Progress in Generating DEM
The end result should be a DEM
DEM created
Raster Contours layer overlay on DEM
We’ve just created a DEM for the region of interest. Try this and give comments.
Passionate about harnessing the power of geospatial technology to create innovative solutions, I'm a GIS Consultant and Developer dedicated to building cutting-edge geospatial applications. With a keen eye for spatial analysis and a knack for problem-solving, I specialize in crafting solutions that seamlessly integrate technology and geography.
Thanks Kibui. The steps are well explained.
Six years later still works perfectly.
Great, thanks a lot 🙂