5.1 Geospatial Lab Application: GIS Introduction: QGIS Version

This chapter’s lab will introduce you to some of the basic features of GIS. You will be using a free open source program to navigate a GIS environment and begin working with geospatial data. The labs in Chapters 6, 7, and 8 will utilize several more GIS features; the aim of this chapter’s lab is to familiarize you with the basic GIS functions of the software. This lab uses the free Quantum GIS (QGIS) software package.

Objectives

The goals for you to take away from this lab are:

Obtaining Software

The version of QGIS used in this lab is 1.8.0, and available for free download at: http://qgis.org/downloads.

Important note: Software and online resources sometimes change fast. This lab was designed with the most recently available version of the software at the time of writing. However, if the software or Websites have significantly changed between then and now, an updated version of this lab (using the newest versions) is available online at http://www.whfreeman.com/shellito2e.

Using Geospatial Technologies

The concepts you’ll be working with in this lab are used in a variety of real-world applications, including:

131

(Source: Kenneth Garrett/National Geographic/Getty Images)

Lab Data

Copy the folder Chapter5QGIS—it contains a folder called “usaproject” in which you’ll find several shapefiles that you’ll be using in this lab. This data comes courtesy of Esri and was formerly distributed as part of their free educational GIS software package ArcExplorer Java Edition for Educators (AEJEE). For use in this lab with QGIS, it has already been projected for you to the US National Atlas Equal Area projection.

Localizing This Lab

The dataset used in this lab is Esri sample data for the entire United States. However, starting in Section 5.6, the lab focuses on Ohio and the locations of some of its cities. With the sample data covering the state boundaries and city locations for the whole United States, it’s easy enough to select your city (or cities nearby) and perform the same measurements and analysis using those cities more local to you than ones in northeast Ohio.

5.1 An Introduction to Quantum GIS (QGIS)

  1. Start QGIS (the default install folder is called Quantum GIS Lisboa). QGIS will open in its initial mode. The left-hand column (where you’ll see the word Layers) is referred to as the Map Legend—it’s where you’ll have a list of available data layers. The blank screen that takes up most of the interface is the Map View, where data will be displayed.
    (Source: QGIS)
    Important note: Before you begin adding and viewing data, the first thing to do is examine the data you have available to you. To do so in QGIS, you’ll use the QGIS Browser—a utility designed to enable you to organize and manage GIS data.
  2. Right click on the QGIS toolbar and a new menu of options will appear. From this menu, place a checkmark in the Browser option. The Browser dialog box will open in a new window below the Map Legend. Double-click on the word Browser and the dialog box will detach itself and become a new floating window that you can move and resize.
  3. The Browser can be used to manage your data and to get information about it. In the Browser tree (the section going down the left-hand side of the dialog box), navigate to the C: drive, open the Chapter5QGIS folder, and then open the usaproject folder. You’ll see a list of all the shapefiles available for use in the sample data.
    Important note: this lab assumes that the Chapter5QGIS folder is in this location on the C: drive. If you have copied the data to another location (or another drive), navigate to that one instead.
    (Source: QGIS)
  4. Right-click on the statesproject.shp file and choose the option for Properties. Information about the dataset will be given. (By double-clicking on a layer, it will be added to the Map Legend and displayed—although this is a common way of adding your data so that you can work with it, don’t do it yet, as you’ll be adding data in the following section).
  5. Do the same for the rest of the shapefiles, and examine their information.

    Question 5.1

    rn0B+16Oc9GKVtpYp6X+9c7vwXVJWp/rv3mMtYkhaUdzxnrQDuI8mXO2Y3OPODycUHqC/Q9rM8eahLnBX4Vi9/1/eMZedaMqnx5OMYmQAiTm7Y4U6yYxk/iZcccjxnWAEnt4I7nBUTlFijnPsEC30iMU9uSSsRZD4aLRe2ikYqbV1eIm0eu26X1TcErHUknn
  6. Close the Browser window.

5.2 Adding Data to QGIS and Working with the Map Legend

  1. Back in the main window of QGIS, click on the icon with the green map and the green “plus” button to start adding the data you’ve examined in the Browser to the map. This button is the tool to Add Vector Layers to QGIS (for this lab you’ll use this option since all of your shapefiles represent vector data).
    (Source: QGIS)
  2. In the Add Vector Layer dialog box, select Browse and navigate to the C:\Chapter5QGIS folder. Open the usaproject folder, and then select the statesproject.shp shapefile. Click Open. Once you’ve selected the file, back in the Add Vector Layer dialog box click Open again.
  3. You’ll now see the statesproject shapefile in the Map Legend, and its content will be displayed in the Map View.
  4. In the Map Legend, you’ll see an “x” in the box next to the statesproject shapefile. When the checkmark is displayed, the layer will be shown in the Map View, and when the checkmark is removed (by clicking on it), the layer will not be displayed.
  5. Now add two more layers, citiesproject (a point layer), and intrstatproject (a line layer). All three of your layers will now be in the Map Legend.
  6. You can manipulate the “drawing order” of items in the Map Legend by grabbing a layer with the mouse and moving it up or down in the Map Legend. Whatever layer is at the bottom is drawn first, and the layers above it in the Map Legend are drawn on top of it. Thus, if you move the statesproject layer to the top of the Map Legend, the other layers will not be visible in the Map View since the statesproject’s polygons are being drawn over them.

134

5.3 Symbology of Features in QGIS

  1. You’ll also notice that the symbology generated for each of the three objects is simple—points, lines, and polygons have been assigned a random color. You can significantly alter the appearance of the objects in the Map View to customize your maps.
  2. Right-click on the statesproject layer and select Properties.
  3. In the Properties dialog box, select the Style tab. Here, you can alter the appearance of the states by changing their Style and Color, and then elements of how the polygons are outlined.
    (Source: QGIS)
  4. Click on the button labeled Change. A new dialog box will appear to allow you to alter the statesproject layer into something more appealing to you. Once you’ve selected new colors and are back in the Properties dialog box, click Apply to make the changes, and then click OK to close the dialog box.
  5. Do the same for the citiesproject and intrstatproject shapefiles. Note that you can also alter the points for the cities into shapes like stars, triangles, or crosses, and change their size as well by selecting the button labeled Change… that has the wrench icon. Several different styles are available for the lines of the interstates as well.

5.4 Obtaining Projection Information

  1. Chapter 2 discussed the importance of projections, coordinate systems, and datums. All of the information associated with these concepts can be accessed using QGIS.
  2. Right-click on the statesproject shapefile and select Properties. Click on the Metadata tab in the dialog box. The information you gained from the Browser will be presented again. Carefully read through the information to find what units (as in units of measurement) are being used for the statesproject layer.
  3. Click OK to exit the statesproject Properties dialog box.
    (Source: QGIS)

    Question 5.2

    QSS6l5iJrA9SlYRHzdz998Lv7ck/4FKZQtFa/bnarzvMaYUupWv9vo0KvZRppdiJSLF10sPY/bgiy8Vk0q6VSsle5xYaZ1G9JgqQqkjYM2K+fGjUZSIQ+Rtu4MWPTtTMaFaZEibUS3I=

    Question 5.3

    pgakZ805Nxe4PKuM2+uU4tf+4OAggyoGJHWkEImdgsQlXrJUtK0jFTqeZkQcv/JZ6/cNTkXNBBTg2pxtXGMNU+VuFxnwplHF1nLzxgR3WpyDqBNg3aSb7+HskVKTrz0rjKQXWg==
  4. QGIS also allows you to specify the projection information used by the entire project. Since your layers are in the US National Atlas Equal Area projection, you’ll want to tell QGIS to use this projection information while you’re using this data in this lab. To do this, select the Settings pull-down menu, and then choose Project Properties…
  5. In the Project Properties dialog box, select the Coordinate Reference System (CRS) tab.
  6. Place a checkmark in the box labeled Enable “on the fly” CRS transformation.
  7. In the filter box, type US National Atlas—of the hundreds of supported projections, this will limit your search to find the US National Atlas Equal Area projection.
  8. In the bottom panel, select the US National Atlas Equal Area option.
    (Source: QGIS)

    Question 5.4

    K2Ap6bgcz5/dLHLCzjzR+A2IX7g1D1A8I3Lkl/FUHqlmjlsivydTRJOp6GgmNEOj+2nR4TkcNGp0yMu3+VI0a5K+3VNDTGA/72PHXQ1Sz2TTBNLhHP4KVmXdmQ8802tV
  9. Click Apply to make the changes, and then click OK to close the dialog box.

5.5 Navigating the Map View

  1. QGIS provides a number of tools for navigating around the data layers in the View. Clicking on the magnifying glass with the four arrows icon will zoom the Map View to the full extent of all the layers. It’s good to use if you’ve zoomed too far in or out in the Map View or need to restart.
  2. The other magnifying glass icons allow you to zoom in (the plus icon) or out (the minus icon). You can zoom by clicking in the window or clicking and dragging a box around the area you want to zoom into.
  3. The hand icon is the Pan tool that allows you to “grab” the Map View by clicking on it and dragging the map around the screen for navigation.
    (Source: QGIS)
  4. Use the Zoom and Pan tools to center the Map View on Ohio so that you’re able to see the entirety of the state and its cities and roads.

5.6 Interactively Obtaining Information

  1. Even with the Map View centered on Ohio, there are an awful lot of point symbols there, representing the cities. We’re going to want to identify and use only a couple of them. QGIS has a searching tool called “Look for” that allows you to locate specific objects from a dataset. To use “Look for” do the following:
  2. Right-click on the citiesproject shapefile and select Open Attribute Table. The attribute table for the layer will appear as a new window (we’ll do more with attribute tables in the next section).
  3. At the bottom of the dialog box, in the box next to “Look for,” type Akron.
  4. Next to where you typed Akron is a pull-down menu. Choose NAME from the options.
  5. Click on the Search button. At the top of the dialog box, information should appear saying there is 1 matching feature.
    (Source: QGIS)
  6. Drag the dialog box out of the way, so that you can see both it and the Map View at the same time.
  7. You’ll see that the point symbol for the city of Akron has changed to a yellow color. This means it has been “selected” by QGIS—any actions performed on the cities layer will only affect the selected items, not all of the cities.

    However, all that “Look for” does is locate and select an object. To obtain information about it, you can use the Identify Features tool (the icon on the toolbar is the white “i” and a white cursor in a blue circle). Note that Identify Features will only work with the layer that is selected in the Legend, so make sure that citiesproject (i.e. the layer you want to identify items in) is highlighted in the Legend before choosing the tool.
    (Source: QGIS)
  8. Select the Identify Features tool, and then click on Akron (zooming in as necessary). A new dialog box will open, listing all of the attribute information associated with Akron (it’s actually giving you all of the field attribute information that goes along with that particular record).
  9. Return to the citiesproject attribute table and “Look for” a city called Youngstown. Use the Identify Features tool for Youngstown as you did for Akron.

    Question 5.5

    U8Xeg2oLtj2c97AAbECwImNq+b93adF0VNskdmPTOi6LscKJO64PA+wbpQ9Gv0yywuXzYmd381KoI+Zs87r9W3edGl05Nz+8iDsxRkN2NujIhxOYYwqnqHH/kjYgfxgk7S5Kz3n1e+cH8PIinRjchsb7gnCpnKMgh854YJ8SXWkouszCj5K3dj3G/jZA+D2Ddkaz9Q==
  10. Another method of selecting features interactively is to use the Select Features tool. To select features from the cities layer, click on citiesproject in the Map Legend. The icon for the Select Features tool is a white cursor overtop a yellow outlined polygon (note that if a different icon – i.e. a different Select tool – is present on the toolbar instead, choose the arrow to its right to activate a pull-down menu where you will be able to choose the proper Select Features icon).
    (Source: QGIS)
  11. The Select Features tool allows you to select several objects at once by defining the shape you want to use to select them with: rectangle, polygon, freehand, or radius. For now, use the rectangle (the default option) and select the four cities to the immediate northwest and west of Youngstown—they will become highlighted in yellow instead of Youngstown.

5.7 Examining Attribute Tables

  1. Each of the layers has an accompanying attribute table. To open a layer’s attribute table, right-click on the citiesproject layer in the Map Legend, and then select Open Attribute Table.
    Important note: At the top of the cities’ attribute table, you’ll see that four features have been selected (the four cities near Youngstown). That’s all well and good, but you’ll also see that there are 3557 records in the entire attribute table (which means there are 3557 point objects in the cities data layer). To find those four records would mean a lot of digging through the data. However, QGIS has some helpful sorting features, including one that will separate the selected records from the rest.
  2. At the bottom of the attribute table, put a checkmark in the box next to Show selected only. QGIS will only show the records of the four cities you selected.
    (Source: QGIS)

    Question 5.6

    SWl7lUhELbISu7+xEiVr/ABNiSCPtTNck8dmz0r5B1VUBaIAHUbJEuAhhMuEv8Jew0Q+qAwJaoQD21YP7ojHZL4cKQ0xAYHX

    Question 5.7

    w/n8MyDwPIHnB3UjHgUwKTh1DHa7m7m0ntNwOMXp6AdU7LL5//RnmILhesxq2SOxLdpORSCH6lpqJWMCpngbo+D2wsm9PtCQywFTiQpDrBYuvirA+mSmK73NeYzuyMLgchC4I42Jf0o0OsQB7P/P+IYCkQU=
  3. To clear the selected features, select the unselect all icon at the bottom of the attribute table.
    (Source: QGIS)
  4. Close the attribute table when you’re done.

5.8 Labeling Features

Rather than dealing with several points on a map and trying to remember which city is which, it’s easier to simply label each city so that its name appears in the Map View. QGIS gives you the ability to do this by creating a label for each record and allowing you to choose the field with which to create the label.

  1. Right-click on the citiesproject layer in the Map Legend and select Properties.
  2. Click on the Labels tab.
  3. Put a checkmark in the box next to Display Labels.
  4. Under Field containing label, choose NAME.
    (Source: QGIS)
  5. For now, accept all the defaults and click Apply and then OK. Back in the Map View, you’ll see that labels of all the city names have been created and placed near each point.
  6. Change around any of the options—font size, color, label placement, and even the angle—to set up the labels however you feel is best for examining the map data.

5.9 Measurements on a Map

With all the cities now labeled, it’s easier to keep track of all of them. With this in mind, your next task is to make a series of measurements between points to see what the Euclidian (straight line) distance is between cities in northeast Ohio.

  1. Zoom in tightly so that your Map View contains the cities of Youngstown and Warren, and the other cities between them.
  2. Select the Measure Line tool from the toolbar—it’s the one that resembles a blue ruler with a line positioned overtop.
    (Source: QGIS)
  3. You’ll see that the cursor has turned into a crosshairs. Place the crosshairs on the point representing Youngstown and left-click the mouse. Drag the crosshairs north and west to the point representing Girard and click the mouse there. The distance measurement will appear in the Measure box. The value for “ellipsoidal” refers to the “surface” distance, as measured on a sphere. Note that each line of measurement you make with the mouse counts as an individual “segment” and the value listed in the box for “Total” is the sum of all segments.
  4. Continue by measuring another line from Girard to Niles.

    Question 5.8

    A/5P2zjaF9W+qTM4iKM6iDJ9qOwsV69JujYDvYAj6qj/wYjWDeVboxFVkV9Y6tkawC9OohSEwzMGI8aMBigYNXjH6L3zx6ldxATQ/gvICDENlwIfdZUg+rtTwssY9cs1yznWuBcFeNpsS4o+fVfLlnFM9VpmAfah/ikwVZg90DQXSJX5ujNnN26EXI0=
  5. You can clear all of the lines of measurement by clicking on New in the Measure box.

    Question 5.9

    pTc8uzAFcIS876mso01j5yqed7c9RIFTCl3hh6u34a3RqlfeZnZ286s3AphOBRxLF3DE70ELVz8ll3Xs1dLrI0W4kMLF/UUkit/6/Kw1Env2CbhBwGnOEsIA2IvFOtel

    Question 5.10

    ZR9igD7LnU23hLVLIBbjO+8ZlMIWp2Ar6BYfEuyZu6iJ07pJTR9IQOShpIhWEdZ+0XS+gU72JLLs/+tqgunm7Km+6sJ0vZYCRkSV2PdYm5sHNwXSrASmwzpKLU05PVkldOmmQpqBwx8uCJbRKQ2PESMp3PVlM5bQ3tiGs+HY2P0wlbmI1zicWnmmp4vtH6Aa

142

5.10 Saving Your Work (and Working on It Later)

When you’re using QGIS, you can save your work at any time and return to it. When work is saved in QGIS, a “QGS” file is written to disk. Later, you can re-open this file to pick up your work where you left off.

  1. Saving to a QGS file is done by selecting the File pull-down menu, then selected Save Project.
  2. Files can be re-opened by choosing Open Project from the File pull-down menu.
  3. Exit QGIS by selecting Exit from the File pull-down menu.

Closing Time

This lab was pretty basic, but it served to introduce you to how QGIS operates and how GIS data can be examined and manipulated. You’ll be using either QGIS or ArcGIS in the next three labs, so the goal of this lab was to get the fundamentals of the software down. The lab in Chapter 6 takes this GIS data and starts to do spatial analysis with it, while the lab in Chapter 7 will have you starting to make print-quality maps from the data. The lab in Chapter 8 will involve some further GIS analysis, this time concerned with road networks.

143