QGISDay14Aug2010

From OSGeo
Revision as of 03:08, 2 August 2010 by Gfleming (talk | contribs) (deleted superfluous sections and added a user question for last session)
Jump to navigation Jump to search

...back to Africa_Local_Chapter

Introduction to QGIS

What?

Our third OSGeo local chapter meet up! We will show you some cool stuff and start to get people familiar with the brilliant FOSS GeoSpatial products out there, specifically QGIS on this occasion! (FOSS = Free and Open Source Software)

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

You will learn how to drive QGIS and see how QGIS can be used to perform the most common GIS operations, including - making a map (cartography) - overlay analysis - spatial queries - data capture (mapping) and editing - working with different data sources - applying QGIS in your work environment (education, government, etc.) - how QGIS can integrate with other GIS software. - basic spatial analysis (vector and raster)

We will also touch on using PostGIS, GRASS and web services.

It will be a big group of varied experience and from every sector. You'll see how to use QGIS through the whole GIS supply chain and have a go at it yourself. You will also meet a great community and have some fun to boot!

The format will include some presentations, demos and case studies along with some step-by-step hands-on work.

How Much?

R150 to cover costs, lunch and refreshments. That and an open mind are all you need to bring.

Cost includes: lunch, teas, CD/DVD. Any profit goes towards equipping the school's GIS lab. Presenters' time is voluntary.

Pay by EFT before 6 August into: Bridge House School Nedbank Account no: 1470067196 Branch code: 198765 Reference: GIS - your name

Where?

Venue: Bridge House School, next to Graham Beck Estate, Franschhoek

NB: We'll be in the Theatre.

If you want to share transport, one participant has set up this service to help (thanks David).

When?

  • Saturday August 14 2010
  • 08h15 registration for prompt 09h00 start, till 16h00 (or beyond)
  • includes lunch and refreshments

Who

Your friendly presenters for the day will be:

  • Horst Düster Horst is a special guest from the Swiss Canton of Solothurn, where all government systems are 100% FOSS.
  • 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. Tim is on the QGIS project steering committee.
  • Gavin Fleming (gavinjfleming at gmail dot com) - He enjoys his daily FOSS4G fix. He's a freelance 'geoinformation scientist' currently at SAEON and he loves to see cutting edge and useful geospatial applications emerging, especially when they're based on FOSS. Gavin chaired FOSS4G 2008 and leads the OSGeo local chapter/ GISSA FOSS SIG.

RSVP

To confirm, send gavinjfleming at gmail dot com proof of payment and any dietary preference.

Programme and notes

  • Be there in time for a 8h15 registration, 9h00 start
  • Please don't bring your own computer. We'll have 60 networked PCs with a massive screen and good AV.
  • It doesn't matter what GIS experience you have.
  • The programme is subject to change and participant input right to the last minute!

Introduction

9h00-10h00

Note to Horst and Tim

most content dumped here is from previous course in Jhb - pls chop and change or start from scratch as you see fit.

Introduction to FOSS GIS - Horst

Horst will give a presentation and demonstrations on how FOSS GIS is used in the real world.

Intro to the QGIS project - Tim

Driving QGIS

10h20-11h20

First tour of the User Interface - ______

Before we set off into the QGIS journey for today, lets get a bit familiar with the vehicle - the GUI or Graphical User Interface!

The key principle is simplicity - standard GIS functionality should be easy to find and obvious to use. More complex functionality is layered onto QGIS as needed via a plugin or extension mechanism

The QGIS GUI is divided into six areas:

1.Menu Bar

2.Tool Bar

3.Map Legend

4.Map View

5.Map Overview

6.Status Bar


1. Menu Bar

The menu bar provides access to various QGIS features using a standard hierarchical menu. The top-level menus and a summary of some of the menu options are listed below, together with the icons of the corresponding tools as they appear on the toolbar, as well as keyboard shortcuts. Although most menu options have a corresponding tool and vice-versa, the menus are not organized quite like the toolbars. The toolbar containing the tool is listed after each menu option as a checkbox entry.

2. Toolbars

The toolbars provide access to most of the same functions as the menus, plus additional tools for interacting with the map. Each toolbar item has popup help available. Hold your mouse over the item and a short description of the tool’s purpose will be displayed.

Every menubar can be moved around according to your needs. Additionally every menubar can be switched off using your right mouse button context menu holding the mouse over the toolbars.

Tip: RESTORING   TOOLBARS
If you have accidentally hidden all your toolbars, you can get them back by choosing menu option  Settings->Toolbars 

3. Map Legend

The map legend area is used to set the visibility and ordering of layers. Layers listed nearer the top of the legend are drawn over layers listed lower down in the legend. The checkbox in each legend entry can be used to show or hide the layer.

Layers can be grouped in the legend window by adding a layer group and dragging layers into the group. To do so, move the mouse pointer to the legend window, right click, choose Add group . A new folder appears. Now drag the layers onto to the folder symbol. It is then possible to toggle the visibility of all the layers in the group with one click. To bring layers out of a group, move the mouse pointer to the layer symbol, right click, and choose Make to toplevel item . To give the folder a new name, choose Rename in the right click menu of the group.

The content of the right mouse button context menu depends on whether the loaded legend item you hold your mouse over is a raster or a vector layer. For GRASS vector layers the toggle editing is not available.

4. Map View

This is the ’business end’ of QGIS - maps are displayed in this area! The map displayed in this window will depend on the vector and raster layers you have chosen to load (see sections that follow for more information on how to load layers). The map view can be panned (shifting the focus of the map display to another region) and zoomed in and out. Various other operations can be performed on the map as described in the toolbar description above. The map view and the legend are tightly bound to each other - the maps in view reflect changes you make in the legend area.

Tip Zooming the map with the mouse wheel: You can use the mouse wheel to zoom in and out on the map. Place the mouse cursor inside the map area and roll the wheel forward (away from you) to zoom in and backwards (towards you) to zoom out. The mouse cursor position is the center where the zoom occurs. You can customize the behavior of the mouse wheel zoom using the Map tools tab under the Settings > Options menu.


Tip Panning the map with the arrow keys and space bar:  You can use the arrow keys to pan in the map. Place the mouse cursor inside the map area and click on the right arrow key to pan East, left arrow key to pan West, up arrow key to pan North and down arrow key to pan South. You can also pan the map using the space bar: just move the mouse while holding down space bar.


5. Map Overview

The map overview area provides a full extent view of layers added to it. Within the view is a rectangle showing the current map extent. This allows you to quickly determine which area of the map you are currently viewing.

  • Add a single layer to the overview by right-clicking on it in the legend and select x Show in overview . You can also add layers to, or remove all layers from the overview using the Overview tools on the toolbar.


If you click and drag the red rectangle in the overview that shows your current extent, the main map view will update accordingly.


6 Status Bar

The status bar shows you your current position in map coordinates (e.g. meters or decimal degrees) as the mouse pointer is moved across the map view. To the left of the coordinate display in the status bar is a small button that will toggle between showing coordinate position or the view extents of the map view as you pan and zoom in and out.


A progress bar in the status bar shows progress of rendering as each layer is drawn to the map view. In some cases, such as the gathering of statistics in raster layers, the progress bar will be used to show the status of lengthy operations.

If a new plugin or a plugin update is available, you will see a message in the status bar. On the right side of the status bar is a small checkbox which can be used to temporarily prevent layers being drawn on the map view.

At the far right of the status bar is a projector icon. Clicking on this opens the projection properties for the current project.


Making your first project - ___

Often the first thing you want to do in your GIS is pull in the layers you are interested in, symbolise them, zoom to the correct position and then save the map that results as a project (similar to a .apr or a .mxd file). This is all pretty easy in QGIS, as you might expect. So the steps we will do are:

  • Create New Project
  • Add Vector Layer
  • Add Raster Layer
  • Add Database Layer
  • Perform simple symbology change
  • Set up some project properties
  • Zoom in to an area of interest
  • Add a north arrow and a scalebar
  • Save the project
  • Close and reopen it


Advanced symbolisation - the renderer types, labelling and map actions - ____

Make it the way you want it to be!

Before we look at symbolisation, lets get to know the data a bit better. Right-click on a layer and select Properties. This is called the Layer Properties dialog. Then click on the Metadata tab.

The Metadata tab contains information about the layer, including specifics about the type and location, number of features, feature type, and the editing capabilities. The Layer Spatial Reference System tab provides projection information, and the Attribute field tab lists fields and their data types for a vector layer. This is a quick way to get information about the layer.

Symbolisation introduction

To make your map look the way you want it, double-click on a layer in the legend or right-click on the layer and select Properties from the popup menu. Then go to the Symbolisation tab.

For a vector layer you will probably see at least the following options: Outline style - pen-style for your outline of your feature. you can also set this to ’no pen’. Outline color - color of the ouline of your feature Outline width - width of your features Fill color - fill-color of your features. Fill style - Style for filling.

Click on the “Fill color” selector, and select a different colour from the pallette that becomes available. Then click Apply, and have a look at how your map has changed. Then click on the “Outline color” and then the “Fill style” selector, change the option and click Apply or OK to see the result.


Setting symbolisation options – Vector map layers

Select the Symbology tab (along the top), go to the “Legend type” choice box and and have a look at the options. You can choose to draw a vector in a number of ways, as a: Single symbol (the default) – all objects in a layer are drawn with the same symbol. Graduated symbol – objects within the layer are displayed with different symbols classified by the values of a particular field. Continuous colour. Unique value.

Now select Graduated symbol, and set the Classification field.

Notice that you can set how to group the symbols, and how many groups to use. If you want to set the options manually, then use Empty.


Now you try. Experiment with different numbers of classes and make it look just right! Ask one of the presenters for advice if the result is not as you expected.

Also try the “Continuous colour” and “Unique Value” options out. Remember that you can save your settings to a file with the “Save Style” button. This means that when you start another project, you can load that same style again for a layer.

You can also “Save as Default”, so that objects are given the style you have chosen automatically when they are loaded.

If you want to display many polygon layers at the same time, the Transparency slider (at the top right hand of the Symbology tab) is useful.


More symbolisation options: Labelling vector layers

  • Open the Layer Properties dialog.
  • Click on the Labels tab.
  • Check the Display labels checkbox to enable labeling.
  • Choose the field to label with. You can enter a default for features that have no name.
  • Click Apply .


Now we have labels. How do they look? They are probably too big and poorly placed in relation to

the marker symbol for the lakes.


  • Select the Font entry and use the Font and Color buttons to set the font and color. You can

also change the angle and the placement of the text-label.


To change the position of the text relative to the feature:

   1. Click on the Font  entry.
   2. Change the placement by selecting one of the radio buttons in the Placement group. To fix our
      labels, choose the ⊙ Right radio button.
   3. the Font size units allows you to select between ⊙ Points or ⊙ Map units.

4.Click Apply to see your changes without closing the dialog.


Things are looking better, but the labels are still too close to the marker. To fix this we can use the

options on the Position entry. Here we can add offsets for the X and Y directions. Adding an X

offset of 5 will move our labels off the marker and make them more readable. Of course if your marker

symbol or font is larger, more of an offset will be required.

The last adjustment we’ll make is to buffer the labels. This just means putting a backdrop around

them to make them stand out better. To buffer the lakes labels:

   1. Click the Buffer   tab.
   2. Click the x Buffer Labels? checkbox to enable buffering.
   3. Choose a size for the buffer using the spin box.
   4. Choose a color by clicking on Color and choosing your favorite from the color selector. You
      can also set some transparency for the buffer if you prefer.
   5. Click Apply to see if you like the changes.

If you aren’t happy with the results, tweak the settings and then test again by clicking Apply .


A buffer of 1 points seems to give a good result. Notice you can also specify the buffer size in map units if that works out better for you.


The remaining entries inside the Label allow you to set all the attributes stored in the layer. The entries beginning with Data defined parameters for the labels using fields in the layer.

Note that the Label tab provides a preview-box where your selected label is shown.



Actions Tab

QGIS provides the ability to perform an action based on the attributes of a feature. This can be used to perform any number of actions, for example, running a program with arguments built from the attributes of a feature or passing parameters to a web reporting tool.

Actions are useful when you frequently want to run an external application or view a web page based on one or more values in your vector layer. An example is performing a search based on an attribute value.



Symbolisation options – Raster map layers

To view and set the properties for a raster layer, double click on the layer name in the map legend or right click on the layer name and choose Properties from the context menu. There are several tabs on the dialog:

   • Symbology
   • Transparency
   • Colormap
   • General
   • Metadata
   • Pyramids
   • Histogram


Symbology Tab QGIS can render raster layers in two different ways :

  • Single band - one band of the image will be rendered as gray or in pseudocolors.
  • Three band color - three bands from the image will be rendered, each band representing the red, green or blue component that will be used to create a color image.

Within both render types you can invert the color output using the x Invert color map checkbox.


Single Band Rendering

This selection offers you two possibilites to choose. At first you can select which band you like to use

for rendering (if the dataset has more than one band).

The second option offers a selection of available colortables for rendering.

 The following settings are available through the dropdownbox color map.  Grayscale
is the default setting. Also available are:
   • Pseudocolor
   • Freak Out
   • Colormap


When selecting the entry color map Colormap, the tab Colormap becomes available.


Colormap Tab

Three ways of color interpolation are available:

  • Discrete
  • Linear
  • Exact


The button Add Entry adds a color to the individual color-table. Double-Clicking on the value-

column lets you inserting a specific value. Double clicking on the color-column opens the dialog

Select color where you can select a color to apply on that value.


Alternatively you can click on the button

table from the band (if it has any).


The block Generate new color map allows you to create newly categorized colormaps. You only need to select the number of classes you need and press the button Classify. Currently only one Classification mode, Equal Interval, is supported.


Raster symbolisation: Histogram Tab The Histogram tab allows you to view the distribution of the bands or colors in your raster. You must first generate the raster statistics by clicking the Refresh button. You can choose which bands to display by selecting them in the list box at the bottom left of the tab. Two different chart types are allowed:

   • Bar chart
   • Line graph

You can define the number of chart columns to use and decide whether you want to

allow approximation or display x out of range values Once you view the histogram, you’ll
notice that the band statistics have been populated on the metadata tab.

Projection basics - ____

    • Note:** I think we should leave out projections for the sake of this course. We provide all data in the same CRS and everything ready to run.

At least demonstrate projections to show serious users what can be done. (Can 1.5 project raster on the fly yet?)


Tea break

Data capture and manipulation

11h40-12h40

Spatial analysis

13h00-14h00

Lunch

Map production

14h30-15h30 You've been putting together a nice project and now you need to output a proper map. This is one area where FOSS GIS doesn't meet the expectations of those raised on proprietary GIS, but it's improving all the time.

In QGIS there are a few options

  • Quick and easy

Go to Plugin manager in tools and enable the 'Quickprint' plugin.

Click on the Quick Print logo which is a pdf symbol.

Fill in the details and you project view will be saved as a pdf.

  • Export an image

Goto File>Save as Image. You can choose to save a png or jpg of your project view.

  • Use the Print Composer

Goto File>Print Composer. This is where you can add titles, legends, scale bars, etc.

If you want a graticule or north arrow, first add these in the project using a plugin.

Then use the print composer to add items to a 'canvas', after which you can change their properties until your map's ready to plot.

Q&A, more show and tell, advanced topics, etc

15h45-17h00

Audience Selections

Tell us what else you'd like to try. Questions and answers. Resources. Possibly some in-depth examples based on frequent questions. What would you like to see at future workshops?

  1. How can we use a GPS with QGIS to do live mapping or navigating?

Possible Extras

  • Advanced spatial analysis without GRASS: Carson Farmer's plugins with R, etc - Gavin
  • Introduction to the Python console
  • The Python API
  • 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.

What you can do next

Install QGIS at home or work on Windows, Mac or Linux and start playing.

Read the manual.

Check out these free QGIS tutorials and courses: http://www.osgeo.org/educational_content?filter0=&filter1=qgis&filter2[]=English&filter3=

Join the QGIS community

Your assessment of the workshop

Tell us what you thought!

Where to get free spatial data?

Surveys and Mapping, Demarcation Board, OpenStreetMap, GPS, etc. Check out South_African_Geodata