Professional Documents
Culture Documents
Introduction to QGIS
Presented at the 2011 CAR Conference, Raleigh, NC Timothy C. Barmann The Providence Journal / projo.com tbarmann@projo.com 401-277-7369
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 2 of 50
Download
QGIS open source software North Carolina counties shapefile [Check the box for County and Equivalent (Current) and click download.] North Carolina population estimates Excel spreadsheet jQuery Can link to a jQuery CDN - no need to download jQuery plugins: Tooltips, Maphilight, Metadata Web page map template OR ... One zip file with everything except QGIS. (2.5 mb) http://www.projo.com/temp/tim/nicar/qgis_files.zip One zip file with this tutorial, everything except QGIS. (9.5 mb) http://www.projo.com/temp/tim/nicar/qgis_files_and_tutorial.zip
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 3 of 50
Workshop objective
To make simple choropleth interactive map for a web page using QGIS, free open source mapping software.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 4 of 50
Choropleth mapping
A choropleth map is a thematic map that has shaded or colored geographic regions to represent differing values, such as population density or per-capita income. It gives a snapshot of how a particular measurment or characteristic varies from place to place.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 5 of 50
What we need
Shapefile Data GIS software
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 6 of 50
Shapefile
A collection of files that describe points, lines, and polygons. A shapefile can be used to represent town boundaries, roads, rivers, and lakes, etc. It can also contain data about the things it describes, such as population, temperature, road types. A shapefile has a file extension of .shp, and usually comes with one or more companion files with extensions dbf, prj, xml and shx. The Census Bureau, as well as many state and local government agencies provide shapefiles.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 7 of 50
Data
The data you want to map, usually in the form of an Excel spreadsheet, Access or MySQL database, or CSV file.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 8 of 50
GIS Software
Quantum GIS, or QGIS, is a widely-used open-source program for GIS work. It's available for free for Windows, Linux and Mac OSX platforms at http://www.qgis.org/. We'll use QGIS to join together the data we want to map with the geographic information stored in the shapefile. Then we'll export an image of the map, and some html code so we can create a web version of the map with live tooltips.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 9 of 50
Other software
I'll assume you have access to Microsoft Excel. If not, you can use Open Office, a free office suite similar to Microsoft Office. You'll also need a simple text editor to create the web page for the map.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 10 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 11 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 12 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 13 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 14 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 15 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 16 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 17 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 18 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 19 of 50
Attribute table
The attribute table holds the data that came with the map as part of the shapefile. We won't need to worry about most of these fields, except "NAME" which is going be our join field to match up the data from the CSV file we've prepared.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 20 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 21 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 22 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 23 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 24 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 25 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 26 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 27 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 28 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 29 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 30 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 31 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 32 of 50
Now in the Attribute table, you'll see the new fields. Note that the values that are stored as strings appear flush left, while those that are stored as numbers are flush right.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 33 of 50
Important step: to save these changes, you must click the editing pencil icon again. Otherwise, these new columns will not be saved.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 34 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 35 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 36 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 37 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 38 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 39 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 40 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 41 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 42 of 50
ready to export. Whatever you see in the map window will be in your final Html map. I prefer to get rid of the default icons that QGIS places on maps: the copy right notice, a measurement bar and a North marker. These are the icons to change these settings.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 43 of 50
Resize the QGIS window to get the map the size you want it to be on your web page. Click the magnifying glass icon with the four outward-pointing areas to make sure you fill up any extra space.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 44 of 50
We're ready to export our map and html code to create an interactive web map. Click on Plugins, and choose Html Image Map Plugin and Image Map.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 45 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 46 of 50
If everything works properly, the plugin will create two files: An html page and an image with the extension png. Open up the html file with a text editor and copy all the code between the start tag and the end tag (including those tags).
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 47 of 50
Open up the web map template page you downloaded earlier. Paste the map code into this template file. Change the src attribute to the name of the png file created by the Html Image Map plugin. Save the web page file.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 48 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 49 of 50
scratches the surface of what QGIS can do. You may want to explore the labeling functions; adding additional layers to the map to include roads and bodies of water; and the other ways to divide up the data into different classes, such as quantiles, which can produce a very different looking map.
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011
Page 50 of 50
http://www.projo.com/temp/tim/nicar/qgis_tutorial/
5/8/2011