AfricaEvents27June2009

...back to Africa_Local_Chapter

Introduction to QGIS

= What? =

Our second OSGeo local chapter meet up! We will chew the cud, show you some cool stuff and start to get people familiar with the brilliant FOSS GeoSpatial products out there, specifically QGIS on this occasion!

We'll go through installing QGIS and getting it to a point where you can have fun (and get your job done) with it.

= How Much? =

There will be a door charge of R250 to cover costs, lunch and refreshments. That and an open mind are all you need to bring.

= Where? =

St Davids Marist Inanda College 36 Rivonia Rd Inanda Sandton Map and Directions

NB: We'll be in the Prep School computer lab.

= When? =


 * Saturday June 27th 2009
 * 08h30 to 15h30
 * includes lunch and refreshments

= Who =

Your friendly presenters for the day will be:


 * Tim Sutton (tim at linfiniti.com) - QGIS hacker and FOSS GIS junkie extraordinaire. Tim eats Weetbix for breakfast because it sounds like Linux. He once rewrote Nkosi Sikelela in C++ because he was feeling patriotic.
 * Graeme McFerren - (graeme.mcferren at gmail.com) - GIS researcher and FOSS4G user. Mmm, aspire to be like Tim then.
 * Gavin Fleming (gavinjfleming at gmail dot com) - I enjoy my daily FOSS4G fix. I'm a 'geoinformation scientist' at Mintek and love to see cutting edge and useful geospatial applications emerging, especially when they're based on FOSS.
 * Brendon Wolff-Piggott - (brendon at integratedgeodata.co.za) - Water resources consultant and FOSS GIS enthusiast. I wish there were more hours in the day to keep up with FOSS4G!

= RSVP = Let gavinjfleming at gmail dot com know if you're coming as numbers are limited.

= Programme and notes =


 * Be there in time for a 8h30 start
 * Computers are provided. All you need to bring is R250!
 * It doesn't matter what level you are.
 * The programme is subject to change and participant input right to the last minute!

Advanced symbolisation - the renderer types, labelling and map actions - Brendon
Loading and viewing data - common data formats, symbolisation. Tips and tricks to enhance image display.

Making your first project - Graeme
- adding layers and saving a project

Map Production - Gavin

 * Tea

Projection basics - Gavin

 * Lunch

GRASS Analysis in QGIS- Brendon
GRASS is a sophisticated standalone GIS package which can also be accessed through QGIS. It installs with QGIS by default. If you don't see a toolbar with grass stalk icons, go to:

View->Toolbars

and check that the GRASS toolbar is has a tick against it. This will place the new toolbar on your QGIS interface.

If you can't see the GRASS toolbar listed there then you may need to add it from the plugin manager:

Plugins->Manage plugins->GRASS


 * Click on the first icon (the folder with a grass stalk) to open the prepared GRASS mapset, which is a collection of maps.

There are three entries needed in the box that opens up:

Gisdbase Location Mapset

These should be set to: home/tim/Grassdata training_jhb analysis


 * Then click OK to open the mapset.

Ask for help from one of the presenters if making these choices is confusing for any reason.

Once this is done, you may use the icons with the '+' symbol to add vector and raster maps from the GRASS database. You may use the QGIS context-sensitive menu (right-click) to remove layers if you do not want to see them.


 * Now open the prepared QGIS project analysis.qgs to see many of the map layers available in GRASS. We are going to use the GRASS toolbox to find answers to some questions that GIS can help us with.


 * Click on the tools icon (with the hammer and spanner) on the GRASS toolbar to open the GRASS tools window.

It has three tabs at the top: Modules Tree, which has a list of GRASS modules grouped according to their function, rather like a Windows Explorer view of directories. Modules List, which has a long list of modules. Type the beginning of a modules name in the box at the bottom to find it rapidly. Browser, which shows you the GRASS map layers grouped into raster and vector groups.

information about the layer in the pane on the right. Try this with raster and vector layers, and notice that the information given is different for the two types.
 * If you pick a map layer in the pane on the left, you will see descriptive

You can leave the GRASS Tools window open while you are working with QGIS.

Why is it so noisy here?

At the end of a long day, you want to put your feet up and relax. But the noise from the freeway just never stops! How many houses in the area are close enough to a major road to be badly affected by noise?

The noise from the freeway will travel further than the noise from a suburban road. Luckily, we already have distances entered against types of road in the Roads map layer.


 * Open the attribute table and have a look.


 * To start the analysis, go to the modules tree and select the module Buffer, under:

Vector -> Spatial analysis

Another tab will open to allow you to run the Buffer module.


 * Select the map layer Roads as input.

...... go to Linux for other detail: select attrib for Buffer
 * Enter Roads_buffer as the name of the output layer.


 * Then press Run.

The progress bar at the bottom will show you how much longer you have to wait. When it is finished, click on View output to show the result in QGIS.

See how the buffers are wider around the freeway than around the main roads.

Tip: You can close the tab for the module using the Close button next to View output.

Now we want to see how many houses are affected. We have the erven outlines rather than houses, but it will be a good approximation.


 * Click on the Modules List tab, and type "v.select" at the bottom. The v.select.overlap module should appear at the top.  Click on the module name to open it.


 * Select Erven as the first input map layer.


 * Select Roads_buffer as the second input map layer.


 * Enter Erven_noise as the output map layer.

This will show you all erven overlapping the noise buffer that we created.
 * Click on Run, and View output.


 * Open the attribute table and scroll down to the bottom to see how many houses are affected.

You might want to use the Group option in the Layer Manager after doing an analysis, so that you can keep the results together. Move the group to the bottom of the Layer Manager when you are finished with it.

I can see you!

The way noise travels depends on a lot of things apart from distance. One of these is changes in height. We are going to generate an elevation surface (raster) to help us in our work.

Raster layers need to have their extent and grid size defined before we start.


 * Click on the Modules List tab, and type "g.region.multiple.vector". Enter one vector layer, v_5m_contours.
 * Now open the Modules Tree, and start the GRASS shell at the top of the list.
 * Enter g.region res=25 to set the grid resolution to 25m.
 * Close the shell.

Now we can start the real work:


 * Click on the Modules List tab, and type "v.surf.rst". Open the module.
 * Select the layer v_5m_contours as the input map layer.
 * Enter elevation as the output map surface.
 * Click Run. This process may take a little while.
 * Add the elevation surface to your display.

You may want to change the way the elevation surface displays using the Symbology options.

Now that we have an elevation surface, we can derive a lot of other information. First we will make it look better though.


 * Click on the Modules List tab, and type r.slope.
 * Choose the r.slope.aspect.aspect module.
 * Enter the name of the output map as aspect.
 * Run and add the layer.

Set this layer to about 50% transparency for a pleasing effect.

A new 32 storey shopping mall and conference centre is being proposed for development. The residents are upset that it will dominate the skyline. The architect says that it will be "bold and pleasing". How can we tell how visible it is going to be?


 * Select the r.los module.
 * Enter the coordinates of the proposed mall:
 * Enter the height as 165.
 * Enter 25000 as the maximum distance.
 * Enter elev_shade165 as the output surface name.
 * Run and view the surface to see where the development will be visible from.

Now you try - change the height of the building to what you feel is reasonable, and see what difference it makes.

Finding a home


 * Select the v.extract.where module.


 * Select land_use as the input map layer.


 * Enter landuse like Park OR landuse like Botanical Garden OR Bird sanctuary


 * Enter open_space as the output map layer name.


 * Run and view the output.

You have extracted the open areas suitable for children from the land use layer.

Now buffer these to a distance of 3km using v.buffer.

Then use the v.to.rast.constant module to convert this vector layer to a raster surface r_open_space.

West to north-west facing areas will suit our young family. A raster "mask" needs to be set up to include only suitable aspects. GRASS recognises the raster named MASK for this.


 * Enter the expression:

r.mapcalc 'MASK=(((relief@Analysis<315)&&(relief@Analysis>=270)))'

If you are feeling adventurous you can use the visual mapcalc interface to set up the expression instead.


 * Now use the simple mapcalculator r.mapcalculator. Enter open_space as the first layer (A) and aspect as the second layer (B).


 * Enter the formula A*B.


 * Run and display the output.

These are the places where are young family should look first to be happy in their new home!

Audience Selections
Tell us what else you'd like to try.

Show off session
Here we can do some whizz bang demo stuff that we don't have time to do in workshop format but that will give you some hints as to what else can be achieved.

e.g. Terrain modelling and drapes.

General
Questions and answers. What you can do next. Resources. Possibly some in-depth examples based on frequent questions. What would you like to see at future workshops?

Possible Extras

 * advanced spatial analysis without GRASS: Carson Farmer's plugins with R, etc - Gavin
 * Introduction to the Python console
 * The Python API

Your assessment of the workshop
Tell us what you thought!

PS: Where to get free spatial data? Surveys and Mapping, Demarcation Board, OpenStreetMap, GPS, etc. Check out South_African_Geodata