Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in...

10
York University Map Library July 2015 1 Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and the census data separately, then join the two files in QGIS 2.6. In this guide, we will download the 2011 population for each census tract in Toronto. Downloading Census Boundaries 1. To download the census boundaries, go to the Statistics Canada census boundary files web page. http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-eng.cfm 2. Click on the appropriate year to download. Note the difference between the cartographic and digital files. For our purposes, we want to download the cartographic boundary file.

Transcript of Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in...

Page 1: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 1

Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and the census data separately, then join the two files in QGIS 2.6. In this guide, we will download the 2011 population for each census tract in Toronto.

Downloading Census Boundaries 1. To download the census boundaries, go to the Statistics Canada census boundary files web page. http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-eng.cfm 2. Click on the appropriate year to download. Note the difference between the cartographic and digital files. For our purposes, we want to download the cartographic boundary file.

Page 2: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 2

3. Select the language and the format of the boundary (.shp) , and select Census Tracts under Cartographic Boundary File, as shown below.

Page 3: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 3

Add vector layer

4. Download the zip file to an appropriate folder. Unzip the file, then open QGIS. Use the Add vector layer button to add the shapefile of census tracts to QGIS.

Page 4: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 4

Downloading the Census Data 1. The next step is to download the census data, using the CHASS Canadian Census Analyzer. http://dc1.chass.utoronto.ca/census/index.html 2. Select 2011 for the year, and then choose Profile of Census Tracts (cumulative). 3. Next, choose 2011 Population for Toronto. Check the “T” box at the top, and select Toronto. In the variables box, select Population, 2011, under the Population and dwelling counts tab. You can also add additional variables here.

Page 5: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 5

4. Next, choose your output options, in the same page. Make sure to select Comma-Separated Values (CSV) file, and click Submit Query. 5. The next page will contain the data and column header files. Download both to an appropriate folder.

Page 6: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 6

6. In QGIS, add the CSV file, using the Create a Layer from a Delimited Text file button. Choose CSV as a file format, and be sure to select the No geometry option, as the CSV file does not have coordinates. The header text file will contain the names of the columns in the CSV. For example, COL0 is the GEO UID, and COL1 is the Population, 2011.

Joining the Data and Boundary Files Using QGIS 1. In QGIS, you should have the tract file (shapefile) and the data file (CSV) both showing in the Layers Panel on the left side of the screen. If the Layers panel is not viewable, add by selecting View Panels Layers

Page 7: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 7

2. To join the two tables, they must have a common field that contain the same values. To identify the common field, right click on each file and select “Open Attribute Table”. You will notice that the COL0 column in the data table is the GEO UID in the header file. COL0 corresponds with the CTUID column in the boundary shapefile (.shp).

Attribute table for census data (CSV)

Attribute table for boundary file (.shp)

Page 8: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 8

3. To join the census data to the boundary file, right click on the boundary file and select Properties. Note: You must start with the boundary file, not the data file. Select Joins on the left side, then click the green plus sign button, to bring up the Add vector join dialog. For the Join layer, choose the data file, then COL0 for the join field, and CTUID for the target field. Click OK, then OK again.

Page 9: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 9

4. Open up the attribute table for the boundary file. The attribute table should now have COL0 from the census data added to it. This shapefile shows all of the census tracts in Canada, but the population was only for Toronto. We can now select just the tracts in Toronto, and save the shapefile as a permanent shapefile with the population counts. Note: the join is only temporary, you must resave the shapefile to keep the join. In the attribute table, click the “Select features using an expression” button. In the Select by expression dialog box, double click the CMANAME field on the left side. This will add the field name to the Expression box at the bottom. On the right side, click “all unique” button. This will bring up all unique values in the Field of CMANAME. Double click “Toronto”. In the expression box, add an equal sign between CMANAME and TORONTO. Click “Select”.

Page 10: Instructions for Mapping 2011 Census Data in QGIS 2 · Instructions for Mapping 2011 Census Data in QGIS 2.6 To map 2011 census data, you must download the census boundary files and

York University Map Library July 2015 10

5. Next, right click on the boundary shapefile in the Layers panel, and select “Save as…”. Give the shapefile a new name, and be sure to “Save only selected features”. Click OK. Finally, you should be left with a shapefile of all the census tracts in Toronto, with the 2011 population counts in the attribute table. There may be some tracts with a NULL value still in the population count field, generally this is because the census data isn’t available.