Installing QGIS 2.0 and Adding Layers

{% include toc.html %}

Lesson Goals

In this lesson you will install QGIS software, download geospatial files like shapefiles and GeoTIFFs, and create a map out of a number of vector and raster layers. Quantum or QGIS is an open source alternative to the industry leader, ArcGIS from ESRI. QGIS is multiplatform, which means it runs on Windows, Macs, and Linux and it has many of the functions most commonly used by historians. ArcGIS is prohibitively expensive and only runs on Windows (though software can be purchased to allow it to run on Mac). However, many universities have site licenses, meaning students and employees have access to free copies of the software (try contacting your map librarian, computer services, or the geography department). QGIS is ideal for those without access to a free copy of Arc and it is also a good option for learning basic GIS skills and deciding if you want to install a copy of ArcGIS on your machine. Moreover, any work you do in QGIS can be exported to ArcGIS at a later date if you decide to upgrade. The authors tend to use both and are happy to run QGIS on Mac and Linux computers for basic tasks, but still return to ArcGIS for more advanced work. In many cases it is not lack of functions, but stability issues that bring us back to ArcGIS. For those who are learning Python with the Programming Historian, you will be glad to know that both QGIS and ArcGIS use Python as their main scripting language.

Installing QGIS

Navigate to the QGIS Download page. The procedure is a little different depending on your operating system. Click on the appropriate Operating System. Follow the instructions below.

Mac Instructions

{% include figure.html filename="qgis1.png" caption="Figure 1: Click to view full-size image" %}

Windows Instructions

{% include figure.html filename="qgis2.jpg" caption="Figure 2" %}

QGIS is very simple to install in most versions of Linux. Follow the instructions on the download page.

Prince Edward Island Data

We will be using some government data from the Canadian province of Prince Edward Island. PEI is a great example because there is a lot of data for free online and because it is Canada's smallest province, making the downloads quick! Download PEI shapefiles:

  1. http://www.gov.pe.ca/gis/license_agreement.php3?name=coastline&file_format=SHP
  2. http://www.gov.pe.ca/gis/license_agreement.php3?name=lot_town&file_format=SHP
  3. http://www.gov.pe.ca/gis/license_agreement.php3?name=hydronetwork&file_format=SHP
  4. http://www.gov.pe.ca/gis/license_agreement.php3?name=forest_35&file_format=SHP
  5. http://www.gov.pe.ca/gis/license_agreement.php3?name=nat_parks&file_format=SHP
  6. PEI Highways
  7. PEI Places

Starting Your GIS Project

Open QGIS. The first thing we need to do is set up the Coordinate Reference System (CRS) correctly. The CRS is the map projection and projections are the various ways to represent real world places on two-dimensional maps. The default is WGS84 (it is increasingly common to use WGS 84 which is compatible with Google Earth type software), but since most of our data and examples are created by Canadian governments we recommend using NAD 83 (North American Datum, 1983). For more on NAD 83 and the Federal Government's datum, see NRCan's website. PEI has its own NAD 83 coordinate reference system which uses a Double Stereographic projection. Managing the CRS of different layers of information and making sure they are working correctly is one of the most complicated aspects of GIS for beginners. Nonetheless, if the software is setup correctly, it should convert the CRS and allow you to work with data imported from different sources. Select Project Properties

{% include figure.html filename="qgis3.png" caption="Figure 3" %}

{% include figure.html filename="qgis4.png" caption="Figure 4" %}

{% include figure.html filename="qgis5.png" caption="Figure 5" %}

You are now set up to work on the tutorial project, but might have a few questions about what CRS to use for your own project. WGS83 might work in the short term, particularly if you are working on a fairly large scale, but it will be difficult to accurately work on local maps. One hint is to learn what CRS or Projections is used for paper maps of the region. If you are scanning a good quality paper map to use as the base layer it might be a good idea to use the same projection. You can also try searching the internet for the more common CRS for a particular region. For those of you working on North American projects identifying the correct NAD83 for your region will often be the best CRS. Here are a few links to other resources that will help you choose a CRS for your own project: Tutorial: Working with Projections in QGIS

Building a Base Map

Now that your computer is driving with the right directions, it's time to add some information that makes sense to humans. Your project should start with a base map, or a selection of geospatial information that lets your readers recognize real world features on the map. For most users this will be comprised of several 'layers' of vector and raster data, which can be rearranged, coloured, and labeled in such a way that they make sense to your readers and your project's objectives. A relatively new feature on many GIS programs is the availability of pre-fab base maps, but since this technology is under development for open source platforms like QGIS we will walk through the process of creating our own base map by adding vector and raster layers in this module. For those who would like to add pre-fab base maps to QGIS, you can try installing the 'OpenLayers' Plugin under Plugins->Manage and Install Plugins. Select "Get More" on the left. Click OpenLayers and then click Install plugin. Click OK and then click close. Once installed, you'll find OpenLayers in the Plugins Menu. Try installing some of the different Google and OpenStreetMaps layers. At the time of writing this module, the OpenLayers plugin (v. 1.1.1) installs but fails to work properly on any Mac using OSX. It appears to work more consistently on QGIS running on Windows 7. Give it a try, as we expect it will only get better in the months ahead. Note, however, that the projection for some of these global maps do not correct on the fly, so the satellite images might not alway sync up with data projected in a different CRS.

Opening Vectors

Vectors defined: GIS uses points, lines, and polygons, also known as vector data. Its first order of work is to arrange these points, lines, and polygons and project them accurately on maps. Points may be towns or telephone poles; lines could represent rivers, roads, or railroads; and polygons could encompass a farmer's lot or larger political boundaries. However, it is also possible to attach historical data to these geographical places and study how people interacted with and changed their physical environments. The population of towns changed, rivers moved their courses, lots were subdivided, and land was planted with various crops.

{% include figure.html filename="qgis6.png" caption="Figure 6" %}

{% include figure.html filename="qgis7.png" caption="Figure 7" %}

{% include figure.html filename="qgis8.png" caption="Figure 8" %}

{% include figure.html filename="qgis9.png" caption="Figure 9" %}

{% include figure.html filename="qgis10.png" caption="Figure 10" %}

***

{% include figure.html filename="qgis11.png" caption="Figure 11" %}

{% include figure.html filename="qgis12-300x199.png" caption="Figure 12: Click to see full-size image" %}

This will add a dense map showing the different forest cover in 1935. However, to see the different categories, you will need to change the symbology to represent the different categories of forest with different colours. We will need to know which column of the database tables includes the forest category information, so the first step is to open and inspect the attribute table.

{% include figure.html filename="qgis13.png" caption="Figure 13" %}

An Attribute Table will open. It has a number of categories and identifiers. Of particular interest is the LANDUSE category which provides information on the forest cover in 1935. We will now show you how to display these categories on the map.

{% include figure.html filename="qgis14.png" caption="Figure 14" %}

{% include figure.html filename="qgis15.png" caption="Figure 15" %}

{% include figure.html filename="qgis16.png" caption="Figure 16" %}

{% include figure.html filename="qgis17.png" caption="Figure 17" %}

{% include figure.html filename="qgis18-300x283.png" caption="Figure 18: Click to see full-size image" %}

{% include figure.html filename="qgis19.png" caption="Figure 19" %}

{% include figure.html filename="qgis20.png" caption="Figure 20" %}

{% include figure.html filename="qgis21.png" caption="Figure 21" %}

{% include figure.html filename="qgis22.png" caption="Figure 22: Click to see full-size image" %}

{% include figure.html filename="qgis23.png" caption="Figure 23" %}

{% include figure.html filename="qgis24.png" caption="Figure 24: Click to see full-size image" %}

Note that in the Layers menu you can add and remove the various layers we've added to the map much the same way you did in Google Earth. Click on the check boxes to remove and add the various layers. Drag and drop layers to change the the order they appear. Dragging a layer to the top will place it above the rest of the layers and make it the most prominent. For example, if you drag 'coastline_polygon' to the top, you have a simplified outline of the province along with place names.

{% include figure.html filename="qgis25.png" caption="Figure 25: Click to see full-size image" %}

{% include figure.html filename="qgis26.png" caption="Figure 26" %}

Opening Rasters: Raster data are digital images made up of grids. All remote sensing data such as satellite images or aerial photos are rasters, but usually you can't see the grids in these images because they are made up of tiny pixels. Each pixel has its own value and when those values are symbolized in colour or greyscale they make up an image that is useful for display or topographical analysis. A scanned historical map is also brought into GIS in raster format.

{% include figure.html filename="qgis27.png" caption="Figure 27" %}

{% include figure.html filename="qgis28.png" caption="Figure 28" %}

{% include figure.html filename="qgis29.png" caption="Figure 29" %}

{% include figure.html filename="qgis30.png" caption="Figure 30" %}

{% include figure.html filename="qgis31.png" caption="Figure 31" %}

{% include figure.html filename="qgis32.png" caption="Figure 32" %}

You have learned how to install QGIS and add layers. Make sure you save your work!

This lesson is part of the Geospatial Historian.