• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
tutorial quantum gis
 

tutorial quantum gis

on

  • 3,390 views

 

Statistics

Views

Total Views
3,390
Views on SlideShare
3,390
Embed Views
0

Actions

Likes
1
Downloads
232
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    tutorial quantum gis tutorial quantum gis Document Transcript

    • QGIS Workshop Documentation Release 1.0 Pirmin Kalberer September 12, 2011
    • CONTENTS1 Introduction 2 1.1 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Edit QGIS project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Create a new QGIS project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 New Features 4 2.1 Menus/Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Raster provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Raster calculator 5 3.1 Using the raster calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Forms 8 4.1 Custom entry form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2 Forms with QT Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Table join 11 5.1 Table Join Admin1 -> Admin0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 New symbology features 13 6.1 Multiple symbol layers for road symbolization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Advanced labelling 15 7.1 Labelling of city layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7.2 Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Working with WFS(-T) layers 17 8.1 Display a WFS layer with QGIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 8.2 Edit data with WFS-T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Working with QGIS Server 19 9.1 Start GeoExt viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 9.2 Edit QGIS project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.3 Create a new QGIS project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2110 Plugins 22 10.1 Popular plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 i
    • QGIS Workshop Documentation, Release 1.0Contents:CONTENTS 1
    • CHAPTER ONE INTRODUCTIONQuantum GIS (QGIS) is a user friendly Desktop GIS client which lets you visualize, manage, edit, analyse data andcompose printable maps.This workshop is based on OSGeo-Live 5.0 (http://live.osgeo.org), a bootable DVD, USB thumb drive or VirtualMachine.1.1 DocumentationTo learn more about QGIS, a starting point is the Documentation page (http://www.qgis.org/en/documentation.html)on the QGIS homepage.OSGeo-Live contains a A Gentle Introduction to GIS and the QGIS User Guide.1.2 Edit QGIS project 1. Click Geospatial → Desktop GIS → Quantum GIS 2. Choose File → Open Project... from the menu bar 3. Select QGIS-NaturalEarth-Example.qgs and press Open • You should see a world map. 4. Check 10m_populated_places_simple in the Layers tree • Populated places are now displayed: 5. Double click 10m_rivers_lake_centerlines in the Layers tree 2
    • QGIS Workshop Documentation, Release 1.0 6. Change the color in Outline Options to a different blue tone 7. Press OK • Rivers are now rendered in a new color1.3 Create a new QGIS project 1. Choose File → New Project 2. Click Layer → Add Vector Layer... 3. Browse to dataset /home/user/data/natural_earth/10m_admin_0_countries.shp 4. Press Open • You should see all world countries1.3. Create a new QGIS project 3
    • CHAPTER TWO NEW FEATURESThere are many new features to explore. This chapter gives you a few starting points for new features in QGIS 1.6 and1.7.2.1 Menus/Tools • Selection Tool • PG Connection: Buttons • WMS Layer order • Project Properties • Layer Save as • Settings / Options: CRS • Settings / Snapping Options2.2 Raster provider • On-the-fly reprojection 4
    • CHAPTER THREE RASTER CALCULATOR3.1 Using the raster calculator 1. Choose File → New Project 2. Click Layer → Add Raster Layer... 3. Open /home/user/data/raster/SRTM_u03_n041e002.tif 4. Click Raster → Raster calculator... 5. Enter output raster file and a formula: 6. Double click mountains in the Layers tree and set the color map style to Pseudocolor 5
    • QGIS Workshop Documentation, Release 1.0 7. Combine both rasters to remove all points lower than 1000 meters: 8. The resulting raster is a DEM without the points lower than 1000 meters:3.1. Using the raster calculator 6
    • QGIS Workshop Documentation, Release 1.03.1. Using the raster calculator 7
    • CHAPTER FOUR FORMS4.1 Custom entry form 1. Choose File → Open Project... from the menu bar 2. Select QGIS-NaturalEarth-Example.qgs and press Open 3. Zoom in somewhere to speed up redrawing 4. Click Layer → Add PostGIS Layer.... 5. Press Connect on NaturalEarth connection 6. Select 10m_populated_places_simple in the table list 7. Press Add and Close 8. Double click 10m_populated_places_simple in the Layers tree 9. Go to the tab Fields and set the Edit widget types: 10. For the field ISO_A2 create a value map loading data from a layer: 8
    • QGIS Workshop Documentation, Release 1.0 11. Activate the edit mode and digitize a point to see the new edit form:4.2 Forms with QT DesignerQGIS supports also custom forms, created with the QT GUI Designer. QGIS relies on naming conventions for datafields and expressions. This allows QGIS to run forms created with QT designer without compilation.For installing QT designer, open a terminal: 1. Click Applications → Accessories → Terminal Emulator 2. Type sudo apt-get install qt4-designer (Password: user)Now we create a custom form with QT Designer:4.2. Forms with QT Designer 9
    • QGIS Workshop Documentation, Release 1.0 1. Click Applications → Development → QT 4 Designer 2. Select “Dialog with Buttons Bottom” We follow the article on http://woostuff.wordpress.com/2011/09/05/qgis-tips-custom-feature-forms-with- python-logic/ In our case we create an entry form “My custom places” with an entry field name and a read only key field gid 3. Save it as places.ui in /home/userOpen QGIS again and: 1. Double click 10m_populated_places_simple in the Layers tree 2. Go to the tab General, choose /home/user/places.ui as Edit UI and press OK 3. Activate the edit mode and digitize a point to see your new custom form4.2. Forms with QT Designer 10
    • CHAPTER FIVE TABLE JOIN5.1 Table Join Admin1 -> Admin0 1. Choose File → Open Project... from the menu bar 2. Select QGIS-NaturalEarth-Example.qgs and press Open 3. Zoom in somewhere to speed up redrawing 4. Click Layer → Add PostGIS Layer.... 5. Press Connect on NaturalEarth connection 6. Select 10m_admin_0_countries and 10m_admin_1_states_provinces in the table list 7. Press Add and Close 8. Double click 10m_admin_1_states_provinces in the Layers tree 9. Go to the tab Joins and press the + button 10. Select 10m_admin_0_countries, adm0_a3, adm0_a3 and press OK: 11. To see the joined information, right click 10m_admin_1_states_provinces in the Layers tree and select Open attribute table 11
    • QGIS Workshop Documentation, Release 1.0 • You should see all admin0 attributes at the end of a admin line5.1. Table Join Admin1 -> Admin0 12
    • CHAPTER SIX NEW SYMBOLOGY FEATURES • Three new classification modes added to graduated symbol renderer http://linfiniti.com/2010/09/new-class- breaks-for-graduated-symbols-in-qgis/ • Data-defined rotation and size for categorized and graduated renderer (symbology-ng).6.1 Multiple symbol layers for road symbolization 1. Choose File → Open Project... from the menu bar 2. Select QGIS-NaturalEarth-Example.qgs and press Open 3. Zoom in somewhere to speed up redrawing 4. Click Layer → Add Vector Layer from the menu bar 5. Press Browse and navigate to /home/user/data/north_carolina/shape/roadsmajor.shp and press Open 6. Go to the tab Coordinate Reference System (CRS), check Enable ‘on the fly’ CRS transformation and press Ok 7. Right click roadsmajor in the Layers tree and select Zoom to layer extent 8. Double click roadsmajor in the Layers tree and activate the Style tab 9. Press the Change button to edit the line symbol 10. Change the color to black and set 2mm pen width 11. Press + to add a second symbol layer 12. Change the color to white and set 1mm pen width 13
    • QGIS Workshop Documentation, Release 1.0 13. Press Ok and Apply • You should see the major roads, but with artefacts at the end of line segments 14. Press the Symbol levels button and check Enable symbol levels 15. Press Ok and Ok again to close the Layer properties • You should see the major roads with the black symbol layer draws first and the white layer on top6.1. Multiple symbol layers for road symbolization 14
    • CHAPTER SEVEN ADVANCED LABELLING • Data defined label position in labeling-ng http://linfiniti.com/2011/03/interactive-label-placement-in-qgis-1-7/7.1 Labelling of city layer 1. Choose File → Open Project... from the menu bar 2. Select QGIS-NaturalEarth-Example.qgs and press Open 3. Check 10m_populated_places_simple in the Layers tree 4. Click labelling tool (ABC) in the toolbar 5. Activate layer labelling with the following settings and press Apply: 6. Click on tab Data defined settings, set a data defined font size and press Apply: 15
    • QGIS Workshop Documentation, Release 1.07.2 Diagrams 1. Choose File → Open Project... from the menu bar 2. Select QGIS-NaturalEarth-Example.qgs and press Open 3. Double click 10m_populated_places_simple in the Layers tree 4. Activate diagram display with the following settings and press Apply:7.2. Diagrams 16
    • CHAPTER EIGHT WORKING WITH WFS(-T) LAYERSOSGeo-Live contains TinyOWS, a high performance, Transactional Web Feature Service (WFS-T) which is lightweight and easy to deploy, using a CGI or FastCGI interface and using PostGIS for data storage.8.1 Display a WFS layer with QGIS 1. Click Layer → Add PostGIS Layer.... • We display the original PostGIS layer first 2. Press New. 3. Fill in pgrouting as Connection name and Database 4. Press OK. 5. Press Connect. 6. Select ways in the table list 7. Press Add. 8. Zoom in 9. Select Plugins –> Manage Plugins –> WFS Plugin -> OK • Enable the WFS Layer plugin. 10. Click Layer → Add WFS Layer.... • Now we add a WFS layer based on the same table 11. Press New. 12. Fill in tinyows as name http://localhost/cgi-bin/tinyows as URL 13. Press OK. 14. Press Connect. 15. Select ows:ways in the layer list 16. Check Only request features overlapping the current view extent. 17. Press OK. • WFS layer is now displayed: 17
    • QGIS Workshop Documentation, Release 1.08.2 Edit data with WFS-T 1. Click Layer → Toggle Editing. 2. Click Edit → Node Tool. 3. Move a vertex (cross) to another position 4. Click Layer → Save edits. 5. Hide layer unchecking tows:ways in the layer list • You should see the edited way in an other color, coming directly from PostGIS.8.2. Edit data with WFS-T 18
    • CHAPTER NINE WORKING WITH QGIS SERVERQGIS Server provides a web map service (WMS) based on libraries from the Quantum GIS (QGIS) desktop applica-tion.This Quick Start describes how to: • update an existing QGIS project and render it with QGIS Server • create a new QGIS project and open the WMS directly in a browserDocumentation: • http://www.qgis.org/wiki/QGIS_Server_TutorialQuick start for Server Installation on Debian/Ubuntu: • apt-get install qgis-mapserver libapache2-mod-fcgid • -> http://localhost/cgi-bin/qgis_mapserv.fcgiQGIS Web Client: • https://github.com/qgis/qgis-web-client9.1 Start GeoExt viewerOSGeo-Live contains an example of web map viewer based on the GeoExt Javascript framework and using QGISServer for rendering the map. • Click Geospatial → Web Services → QGIS ServerYou should see a browser window with a web map viewer showing a world map. 19
    • QGIS Workshop Documentation, Release 1.0We will now change the map styling using QGIS.9.2 Edit QGIS project 1. Click Geospatial → Desktop GIS → Quantum GIS. 2. Choose File → Open Project... from the menu bar. 3. Select QGIS-NaturalEarth-Example.qgs and press Open. • You should see the same world map rendered by QGIS. We will now change river styling and look at the result in the web map viewer. 4. Double click 10m_rivers_lake_centerlines in the Layers tree. 5. Change the color in Outline Options to a different blue tone. 6. Press OK. • Rivers are now rendered in a new color. 7. Save the project with File → Save Project. 8. Reopen the web browser 9. Zoom in • You should now see rivers rendered in the same new color.9.2. Edit QGIS project 20
    • QGIS Workshop Documentation, Release 1.09.3 Create a new QGIS project 1. Reopen QGIS 2. Choose File → New Project. 3. Click Layer → Add Vector Layer.... 4. Browse to dataset /home/user/data/natural_earth/10m_admin_0_countries.shp. 5. Press Open. • You should see all world countries. 6. Save the project with File → Save Project. 7. Use file name /home/user/world.qgs and press Save. 8. Open the WMS URL (http://localhost/cgi-bin/qgis_mapserv?map=/home/user/world.qgs&SERVICE=WMS&VERSION=1.3.0&R 91.901820,-180.000000,83.633800,180.000000&CRS=EPSG:4326&WIDTH=722&HEIGHT=352&LAYERS=10m_admin_0_co • You should see all world countries, this time rendered by QGIS Server.9.3. Create a new QGIS project 21
    • CHAPTER TEN PLUGINS10.1 Popular plugins • GDAL raster tools • Openlayers Plugin • NumericalDigitize (Create points from coordinates) • Points2One (Create polygos or lines from points) • TableManager (Delete attributes from shape files) • 1-Band Raster Colour Table (Create colormaps for raster layers quickly) • PostGIS versioning http://www.kappasys.ch/cms/index.php?id=23&L=5 • Offline editing http://www.sourcepole.ch/2010/9/29/offline-editing-plugin-for-qgis • Routing (Road graph plugin) http://gis-lab.info/qa/road-graph-eng.html 22