Mapping: intro to GIS and QGIS

This page is a very specific introduction to computer mapping for scholars who have not yet learned GIS, or even what it means. General overviews of GIS are common on the internet, but they tend to be skewed towards commercial software that costs thousands of dollars per license. For the rest of us, this is a quick tutorial of free and full-featured GIS software. It is a mix of background information and tutorial.

THE CONCEPT. You can get all sorts of maps as fixed images on the web, and you can even create your own mashups of Google Earth imagery from screen-captures. But what if you want a map where the information is actually linked to coordinates in the real world? What if you want a map where the graphic information is actually linked to stored data? For example, that blue wiggly line could actually be tagged to data that says it is the Indus River, and gives its length and flow in metric and English units. For maps that are not just flat, inflexible images, you want to use Geographic Information System (GIS) software. GIS software can create and edit maps where the attributes are stored in a database, and the graphic information is georeferenced, meaning that the coordinates are in degrees corresponding with their actual location on earth.

THE SOFTWARE. Here, I am only going to introduce Quantum GIS, or QGIS for short. Before proceeding here, please download and install QGIS on your computer. It is free. By default, QGIS is a native editor of the shapefile format of digital map information. Shapefiles are actually three (or more) separate files, which all have the same name but different suffixes. For example:
mapname.dbf    [the database file that stores the attributes of each element.]
mapname.prj    [a small text file that stores projection information]
mapname.shp    [the graphic data in points, lines, and polygons]
Standard practice in the internet is to zip all these files together, so that users will download all the files simultaneously. As a working example, please download this map of informal residential settlement areas in Kabul. Then you should unzip the files and store them in a folder.

DATA MANAGEMENT. Any new software can be confusing to learn. But I have found that a whole separate challenge is the basic organization of data on your computer. If you are confident about how your organize your files, ignore this paragraph. Otherwise, here are my suggestions: 1. Make folders with very short, but explanatory names. 2. Don’t use spaces or special characters (punctuation) in your folder names. 3. Store each set of shapefiles in a separate subfolder. Here is an example of the pathname to where to store the shapefile I am providing:
Documents/geog/kabul/2001/2001_inf_flat.dbf
Documents/geog/kabul/2001/2001_inf_flat.prj
Documents/geog/kabul/2001/2001_inf_flat.shp
Documents/geog/kabul/2001/2001_inf_flat.shx

OPEN THE SHAPEFILE IN QGIS. Start QGIS, which opens with a blank map area.
Go to Layer > Add Vector Layer… and in the dialog box that opens, browse to the shapefile you have downloaded. Only one overall name of the shapefile will appear. It should look something like the image below:

Initial load of shapefile

Okay! You have loaded a shapefile into a GIS program!

PROJECT THE MAP. Here is one of the really powerful features of GIS software. When it starts, QGIS just loads map data in an unprojected square grid, called a ‘Geographic’ projection. Anything north or south of the equator will be visually distorted, unless you make the software display the map in a projection. Again, map projections are a whole field of specialty, but here we only need to know a few things:
1. The earth is a lumpy, irregular sphere. There are various mathematical models of this potato-shape, but the emerging standard geoid is the Word Geodetic Standard of 1984, abbreviated as WGS84.
2. The emerging standard projection for local urban maps is the Universal Transverse Mercator (UTM) projection, in which the Earth is projected onto a series of flat facets, resembling a dance-hall mirror-ball. The facet we need for Kabul is Zone 42 North.
Okay: now click on the bottom-right button that looks like a gridded sphere. This opens the “Project Properties” window with the second tab selected: “Coordinate Reference System (CRS)”.

CRS selection dialog box

This dialog gives you the option of selecting all the common (and uncommon) projections, and even the option of selecting your own, custom-designed projections. For now, just scroll up to the top in this window and collapse all the boxes. It should then look like:

CRS options, collapsed

Now, you can see that we can select from a variety of Geographic, Projected, and User-Defined Coordinate Systems. Here we are going to select Projected > Universal Transverse Mercator:

Seclecting the UTM projection...

Within the UTM projections, scroll all the way down to near the bottom to pick the WGS84/Zone 42N:

At last! The WGS84/Zone 42N projection...

…and then check the upper-left box labeled “Enable ‘on the fly’ CRS transformation.” Then click OK.

In this case, the view only changes slightly. In cases, the map disappears entirely! If the image disappears, go to View > Zoom Full and it will reset the view to see the full map. Here is why: when you first load the unprojected file, it assumes that the units are degrees. But in many maps, the units are in meters. If you look above, you will see that the scale bar shows 9,000 degrees! Considering that earth is only 360 degrees around, that is actually an impossible condition. But once you set the software to a projected view, your scalebar should be correct. In this case, it now shows 9 kilometers:

A projected view in QGIS

Now save this project (File > Save Project or Ctrl + S) which saves a small file that only includes this projected view and the shapefile loaded into it. When you restart QGIS later, you can go to File > Open Recent Projects and resume work on this projected shapefile. Now you can add more shapefiles as additional layers, and you can change their display settings, and you can do analyses and modifications of the data stored in the databases of each shapefile. Here, I am only going to show you very briefly how to get useable output from this project.

CREATE OUTPUT. Go to File > New Print Composer (Ctrl +P). This opens the Print Composer Window. Here, select the middle icon with the white ‘plus’ on a green circular field. Now, in the main left window, drag out a rectangle and a view of your working file will appear like this:

Print composer window

Now hover your cursor over the top-left icons in this window. Tooltips should reveal the function of each icon, in the following order from left to right:
1. Load from Template [this loads previously-designed Print Composer views]
2. Save as Template [this saves the present view as a Print Composer Template, or .qpt file]
3. Export as Image [this generates a raster output file such as a .jpg, .tif, .png, or .gif]
4. Export as PDF [this generates a Portable Document File]
5. Export as SVG [this outputs a Scaleable Vector Graphics file]
6. Print [this prints the composed view to your default printer]

You are welcome to print hardcopies (sixth button). To add a map to another document, however, you will probably choose button #3, and export as a JPEG or PNG. Here you can set the resolution/compression of your output image.Now you have a useable map image!

Now, you can go to the other pages listed under the GIS drop-down menu to learn where to get more data and how to do more with GIS. All these pages are very introductory, written to be intelligible to social scientists, not cartography specialists.