Date Thu 09 December 2010

A note from Sam in the Linfiniti team:

The last two weeks of FOSS GIS training courses (posted about here) have been impressive.  High-five to the trainers, Tim and Gavin, for their hard work!  Having only being at Linfiniti for a short time, I was assisting with the courses but also learning some things about the software myself.  This is just one of the nice things I learnt from the QGIS course.

Using the GRASS plugin in QGIS opens you to a whole host of new tools. The plugin makes GRASS more accessible, and simplifies the complexity of GRASS datasets, so that more users will be able to benefit from the GRASS functionality available.

You can convert vector contour lines to a raster DEM, and then visualise the DEM in 3D. The steps below are written for newbies (like I was!), so skip the detail if you an experienced user ;)

1. Setting up your mapset and adding your data

When the GRASS plugin is enabled in QGIS, you will get a GRASS toolbar added. Open your contour shapefile in QGIS as you usually would, then click New mapset on the GRASS plugin toolbar. For those new to GRASS mapsets, here are some guidelines:

  • specify the directory (you can make a 'grass' folder in your home directory - it is important you have full read/write access)
  • create a new location - think of this as a project folder based on a certain location (geographical extent)
  • assign the projection of your dataset (your projection will be fixed for the location and mapset)
  • under the default GRASS region section, click the 'Set current QGIS extent' button
  • enter the mapset name (this will be your username - each user can have a mapset in the location, the 'project folder')

Once you've setup, you will see a red outline around the data in your QGIS view, this is your mapset extents.

Click the GRASS tools icon on the toolbar, and find the option to import your vector or raster.  Here's the vector import:


Once you click the function, select the layer to add (the list will show those layers open in QGIS), type a name and click run.

You will also need to add the newly created grass layer to your QGIS view - this will make it accessible for subsequent grass functions.  Add the layer by clicking 'view output' after running the function, or in the browser tab in the GRASS tools dialog - click refresh, find the file and click the add icon.

2. Creating a DEM from contours

Now for the interesting bits.  Make sure your vector contour from your grass mapset is open.  Under the Module list in the GRASS tools dialog, find and run these functions in this order:

  • ** -> converts your vector to raster based on an attribute (use the height attribute from the contours).  Open your result once its run.
  • **-> creates a surface from the rasterized contours.  Tip: edit your mapset region (last icon on the grass toolbar) to adjust the output area to your dataset- this will save time!  Open your result once its run.


3. Visualisation in 3D using nviz

In the modules list, find *nviz*. This can be used to visualise any DEM data, and you can add overlays.  Using a nice colour map as explained in Tim's postwill produce a catching effect.  Running the module, and adjusting the settings (z-exaggeration, lighting, perspective etc) will give you a dynamic 3D view of your data.  Nviz is also apparently capable of 3D fly-throughs for those interested in exploring a bit more.


Voila, and there you go!  And this was all created from the comfort of your QGIS environment, thanks to the awesome plugins that have been added! :)

Hope this helps, and if you've got any questions, feel free to leave a comment!



comments powered by Disqus