Umamodex1year2007

== Intro to Quantum GIS ==
=== Lab Setup ===
==== 1. Get the data files ====
* We will use the following datasets for this lab: a) vector towns boundary for MA, b) vector landuse and roads data for the Town of Amherst, MA, and c) 2 meter resolution orthophoto(s).
* Please download [the dataset] to a temprory folder on your computer. 
* This data was made available from the Massachusetts GIS repository (MassGIS) and is in United States State Plane Coordinate System, Lambert Conformal Conic, NAD83, Massachusetts Mainland.
* Unzip data to your working directory. You should see the following files appear:
**Orthophoto 
***2_117902.aux
***2_117902.tfw
***2_117902.tif
**Landuse layer
***lus8.dbf
***lus8.prj
***lus8.sbn
***lus8.sbx
***lus8.shp
***lus8.shp.xml
***lus8.shp
**Roads layer
***rd5k8.dbf
***rd5k8.shp
***rd5k8.shx
**Towns layer
***TOWNS_POLY.dbf
***TOWNS_POLY.prj
***TOWNS_POLY.sbn
***TOWNS_POLY.sbx
***TOWNS_POLY.shp
***TOWNS_POLY.shx
***TOWNS_POLY_AREACODE.dbf
----
=== Getting Started: Let's look at the Menus of QGIS ===
# Start up QGIS application.
There are 5 major areas of QGIS main screen (Figure 1):
# Table of Contents (layers) on the left
# Map Overview Area
# Standard Menu System
# Zoom and other tools in the button row
# Map area at the center (blank right now)
# Status bar (area at the bottom of the application screen)
The status bar provides information on:
*spatial extent
*scale
*current coordinates of cursor (Figure 2). 
Let's consider menu system and toolbars in detail.
==== Menu ====
QGIS has a standard menu system:
* File > New Project, Open Project, Save Project, Save Project As ..., Print, Export As Image, Export As Mapserver file, Check QGIS Version
* View > Zoom to full extent, Zoom to selected features, Zoom to previous extent, Zoom to layer, Geospatial bookmarks, New Geospatial bookmark, Refresh
* Layer > Add a Vector Layer, Add a Raster Layer, Add a PostGIS Layer, Remove Layer, New Vector Layer, Toggle in Overview, Add All To Overview, Remove All From Overview, Show All Layers, Hide All Layers, Attribute Table, Properties 
* Settings > Project Properties, Custom Projections
* Plugins > Plugin Manager
* Help > Contents, QGIS Home Page, QGIS SourceForge Page
==== Icons ====
Look at the Icon Menus/Toolbars. The major toolbars buttons are described below (Figures N-N)
 
 
 
=== Using QGIS ===
Recall that QGIS is a tool for viewing, querying, editing, composing and publishing electronic maps. It combines functionality for electronic mapping and spatial analysis. For those of you who have seen or used the ArcView 3.x product, it's quite similar. 
# Start QGIS (if you don't have QGIS open)
# The main window will be blank, this is an empty default project. 
# To set project properties click "[Settings > Project Properties]" in the main menu. The "Project Properties" window will appear. 
# Click on the "[General]" tab and set Project Title and Map Units. Call this project Class Demo:QGIS and set the Map Units to Meters.
# To set the projection of the project, click on the projection tab and find Projected Coordinate System, Lambert Conformal Conic, and NAD83 Massachusetts Mainland. 
# Click "[Ok]" button to make changes. (Figure 6)
# First we will add a vector file.
# Click on "[Add a Vector Layer]" button or select "Layer > Add a Vector Layer" in the main menu 
# A dialog window will appear. Please select a landuse layer (lus8.shp) from your working directory.(Figure 7).
# Now let's display the raster file.
# Click on "[Add a Raster Layer]" button or select "Layer > Add a Raster Layer" in the main menu.
# Select orthophoto file 2_117902.tif from your working directory and click [Open]
# You have two overlaying layers now in QGIS (Figure 8): 
# If you don't have the raster image in your view, then select any layer in the Table of Contents (TOC) and click the "Zoom to layer" menu button. The view should refresh itself and you will be able to see two data layers (Figure 9). 
# Click on the raster file (2_117902.tif) and drag it down so that it is listed in the table of contents BELOW the land use vector layer. You should see the raster image covered with the land use layer (Figure 10).
# If the land use layer does not cover the raster image select "View > Refresh"
# Note the coordinates from the map projection being used at the bottom, right hand corner and how they change as you move the cursor around the map. Notice that the units of this coordinate system is meters.
# To specify/change display units click Setting > Project Properties and click on [General] tab in the window (Figure 10). It's a good habit to specify these settings when you start working on the project.
Now let's consider some map tools: 
----
=== Map Tools ===
The map tools provide functions that help you navigate around the map. 
Specific tools:
* Zoom in and out (the magnifying tool + and -). This tool requires you to left-click and draw a rectangle around the area that you want to zoom in on. Zoom in and notice how the map scale (at status bar) changes. GIS is "scale-less" which is why it is important as to what scales input maps were at so you don't try to use the GIS at inappropriate scales!
* Zoom to layer. Select any layer in TOC and try this tool. Please, notice that map extent is set up to the selected layer.
* Zoom to full extent. This tool zooms in such way that all data are viewable in the map area.
----
=== Adding New Layers ===
* We have added one vector layer (land use) and the raster layer (orthophoto image).
* Use the "Add Vector data" button to add road data layer (Rd5k8.shp) for the Town of Amherst.
----
=== Change TOC information ===
Let's change the Table of Contents references:
* Right click on landuse layer entry: "'lus8p1.shp'''
* Choose Properties from the menu
* Layer Properties window will appear
* Click on the General tab
* Change the Layer name to Land Use
* Click "ok". The TOC entry should be changed.
* Change the color of this polygon layer to light green.
** Double-click on the rectengul (or Right click on the layer and select Properties)
** Click on [Symbology] tab
* Change the fill and outline colors of the polygon features. 
* Click [ok] and notice that color of land use layer was changed.
* Whatever layer is at the top of the TOC will be displayed on top
* Move the raster image to the top of the table of contents
** Click and hold on the 2_117902.tif image
** Drag this up to the top of the TOC
** You should see that some line and polygon features disappear because the raster grid is overlaying on the vector layer
----
=== View Attribute Data ===
To look at the associated attribute database for the landuse features:
* Select Land Use Layer in TOC (put the layer on the top)
* Click on "Open Attribute Table" tool button. 
* Scroll to the right to view various records of data
* Polygons represent different land use types. Fields [LU37_Code] and [LU21_Code] store codes of different land use types. 
* Scroll down and select any record (Figure 15).
* To see the selected parcel(s) on the map, switch to the map view and click on the [Refresh] button 
* The selected parcels are shown in yellow color.
* Another way to see attribute information for a specific spatial feature (polygon, in our case), use [Info] tool (Figure 17).
** Click on Info tool and then click on a feature (in the active layer) you are interested in.
** A window containing information for this feature will apear. Scroll down and note that it has the same fields as the attribute table.
----
=== Measuring distances ===
Let's measure the distance between objects on the map. We will use Measure Tool for this operaton.
* Click on the Measure tool (it's a button with picture of ruler on it). 
* Navigate a cursor over a feature and left click with a mouse to set a starting point. Select another point and click again. A window showing segments' length will appear 
* The results will be in the map units you are working in. In this case, meters. 
* Continue to measure or right-click to stop.
----
=== Finishing the work ===
Saving a map as an image: 
* Click File > Export As Image 
* A dialog window will apper. You will need to specify file name and location, as well as to select image format.JPEG and PNG are wide supported formats. So we would advise to save your map as jpeg or png files. Then you can insert them into text document or presentation.
* To save the project, click [File > Save Project (As)]. The next time you can open the project in QGIS and QGIS will restore your work status on the moment of saving. Note: Be sure to check where the file will be saved.
==External Links==
* Wikipedia articles on Image Formats: http://en.wikipedia.org/wiki/Image_formats
* GDAL (Geospatial Data Abstraction Library): http://www.gdal.org
* FW tools: http://fwtools.maptools.org/
* MassGIS: http://www.mass.gov/mgis/
==Author Attribution==
Major contributors to this curriculum include (alphabetical):
Maria Fernandez
Michael Hamel
Quentin Lewis
James Peters
Charlie Schweik
Alexander Stepanov 
==Module Licensing Information==
Version 1.0. http://creativecommons.org/images/public/somerights20.png
This exercise is licensed under a Creative Commons Attribution-ShareAlike 2.5 License and is being developed as a future contribution to the [Open Geospatial Foundation's educational resources effort]. This means that users are free to copy and share this material with others. 
We intend to make this available in summer 2007 to the OSGeo community. Prior to this, we ask that you contact us first if you would like to edit or make a new derivative of this content. Email address: cschweik AT pubpol DOT umass DOT edu).
==Reviewed by==
Quentin Lewis
Category: Education