Finding, Downloading, and Mapping Census Data
The CHASS Canadian Census Analyser allows members of the University of Toronto research community to generate custom tables from the Census of Canada (1961-2016) and the National Household Survey (2011). The interface enables the selection of relevant variables and census geographies, providing access to data down to the dissemination area (DA) level. If you would like to know more about downloading specific datasets from CHASS, please see our Downloading data using CHASS Canadian Census Analyser tutorial. For this excercise, we will explore how to incorporate and visualize census data through a ArcMap's geospatial framework. For this example, we will map the percentage of people whose mother tongue is Mandarin living in the Toronto Census Metropolitan Area (CMA) by census tract (CT) based on the 2016 Census Data.
In this tutorial, we will cover the following topics:
- Download the census data.
- Download the census boundary files.
- Match the two datasets - census data and census boundary files - together in ArcMap.
- Colour code the data to create a thematic map.
- Additional descriptive elements.
- Final edits and export.
A. Download the census data
- Access CHASS Census Analyzer, either through the link provided here or by visiting the MDL homepage and clicking on "CHASS Census Analyzer" under "Major Data Portals".
2. We see two options for obtaining data, by geography or by year. Since we want Census data for 2016, click on 2016.
3. Next we need to download the appropriate geography - the Census Metropolitan Area (CMA) of Toronto - so click on Profile of Census Tracts. (Note: a CMA is a regional boundary delineating a number of adjacent municipalities with a total population of 100,000 or more; visit the Statistics Canada website to learn more.)
4. Under the Step1's "By Name" tab, select T and then Toronto from the list of available items below.
5. Now we must navigate the census' categories and find the variables we are interested in: today, we are looking for total number of Mandarin speakers and total population (in order to calculate a percentage). Under Step2, (1) click on the Language tab and the (2) Detailed mother tongue - Total subsection to find our two variables:
5.1 (3) Select Total - Mother tongue for the total population excluding institutional residents - 100% data; Both sexes (v219) - in this case, "v219" stands for "Variable 219" within the census dataset.
5.2 (4) Further down find and select Mandarin; Both sexes (v456).
6. Next, under Step3, we will select Census Tract name. (We will talk more about this variable later.)
7. Finally, we must select the output format best suited for our visualization; in this case, DataBase File (DBF) format - a table-like format that structures datasets by columns and rows. At the bottom of Step3, under "Select the output format", select dBase (DBF) file and then click on Submit Query.
8. Download the dbf and text files from the links provided (right-click and select Save Link As...) and save them to a folder of your choosing (you may have to wait a few seconds before the links appear on the page). The dbf file will have your data and the text file will contain information about what the column headers mean.
B. Download the census boundary files
- We will obtain the census boundary files from the Census Geography website. You can access the site through the previous link or any time through the Statistics Canada Census website, scrolling down to the Information and Services section, and clicking on Geography.
2. Under Spatial information products, click on Boundary Files.
3. Under Census Year, click on 2016.
4. To set up your download, select English, ArcGIS (.shp), and Cartographic Boundary File next to Census Tracts. Then click Continue.
5. Download the zip file from the link provided and save it to the folder you used above.
6. Geospatial data often comes in a zip file as it is made up of a collection of files. You will need to unzip it to use it in ArcMap. To do so in a Map and Data Library computer, right click on the zip file and select 7-Zip -> Extract Here.
C. Match the two datasets together in ArcMap
- Open ArcMap. (If you are using a Map and Data Library computer, an ArcMap shortcut is available through the desktop or the start menu.)
- Close the "Getting Started" pane to start with a blank map.
- Drag the lct_000b16a_e.shp file we downloaded from the repository you saved it in to ArcMap's Table of Contents and extracted above on to the ArcMap blank space to add the census tract boundaries. The .shp file itself will provide us with the vectors depicting Toronto's CMAs, but to work properly ArcMap will automatically draw from the other files in the folder we downloaded from Statistics Canada.
- Click on the Plus Icon to start adding your census data.
5. (1) Click on the Connect to Folder Icon, to select the folder where your census data is. (2) Browse to your folder's directory, highlight it, and (3) click OK.
6. (1) Select your census data (i.e., the dbf file you downloaded earlier) and (2) click on Add. (Note: unlike the shp. file we added above, integrating this dbf file into ArcMap will not change the map displayed.)
7. For each dataset added, you can view the underlying table of data by right-clicking on each dataset name in the layers list to the left, and selecting either Open Attribute Table or just Open - depending on which file type (shp. vs. dbf.) you are looking at.
8. If you look at each table, you will notice that the boundary file's column CTUID (i.e., Census Tract Unique ID) is equivalent to the CHASS census data's COL0 (i.e., the GEOID or Geography ID). They both identify the same type of regional division, along with any associated information. (Note: Remember you can always change each column's title in ArcMap by right-clicking on the header, selecting Properties... and changing it's "Alias", just make sure you referred back to the text file CHASS provided with the dataset to understand what each column's code stands for.)
Table of attributed behind the boundary file:
Table of attributes in the census data DBF file:
9. We can now join the two tables of data together into one. Right-click on the boudary dataset name in the layers list (i.e., e2Kg332ENCqs_data), and select Joins and Relates, and then Join... (Note: if you wish, you could also join the layer to the dataset, although the steps described below will not entirely match the settings for that process.)
10. (1) Pick the column name we want to match in the boundary file, CTUID. (2) The second field should be automatically filled in. (3) Pick the column name we want to match with the DBF file, COL0 (if it has not been filled in automatically or correctly). (4) Select Keep only matching records (so that we only display Toronto on our map), (5) Finally click OK.
11. Let's look at the result of our join. Right-click on the boundary dataset name in the layer list to the left (i.e., lct_000b16a_e), and this time select Zoom To Layer. Your map should look more recognizable now, showing you areas of Toronto. (Note: if you now went back in and opened the attribute table of the boundary dataset, you would notice that your columns of census data have now been appended - i.e., joined - to the end of the table - all the data is consolidated in one place.)
D. Colour-code the data to create a thematic map
- Right-click on the boundary dataset name in the layers list on the left (i.e., lct_000b16a_e), and this time select Properties...
2. (1) Select the Symbology tab. (2) Click on Quantities and then click on Graduated colors. If you recall when we downloaded the DBF file, there was an associated text file telling us which column was which. In our example here, COL3 is the number of people whose mother tongue is Mandarin, and COL2 is the total population. Let's divide the number of Mandarin speakers by the total to get the percentage of Mandarin speakers living in each area. (Note: even if you follow these exact steps, the column headings are not always the same, so always check the text file to confirm.) (3) Under Fields, for Value, select COL3 and, for Normalization, select COL2. (4) Select a colour ramp (a graduated colour ramp makes sense to show areas ranging from lower to higher intensity/percentage). (5) Finally, click on OK.
3. You should now see a thematic map of the CMA of Toronto displaying colours representing a percentage of those people whose mother tongue is Mandaring living in various census tracts based on 2016 Census Data. Visualizing data through GIS can help us see spatial patterns not obvious by viewing the data in a table: for example, here we can see a large concentration of people whose mother tongue is Mandarin living in the northeast side of Toronto.
E. Additional descriptive elements
- Before formatting our map, we should edit our labels to make the data we wish to present clearer. Right-click again on the boundary dataset name in the layers list on the left (i.e., lct_000b16a_e) to access Properties... and the Symbology tab. (1) Now right-click on the Label header and (2) click on Format Labels...
2. Under Category, (1) click on Percentage and (2) mark that our number already represents a fraction so we would like to show it as a percentage.
3. Do a long click on the "COL3/COL2" label within the layer list to the left. You should be able to change the name of the field to something more informative; for our example, we will call it "Native Mandarin Speaker Percentage per Area".
4. Now let's format how our map will print and add a couple of additional elements such as a legend and a scale bar. First, change from Data View to Layout View by clicking on the Layout View button at the bottom of the window.
5. In this view, one can click on the map and pull from points in its sides or corners to resize its placement on the sheet. (Note: To change the areas displayed, you must head back to Data View and zoom-in or zoom-out on the location you wish to present.)
6. To add a scale, go to the top of the window and click on Insert and then on Scale Bar...
7. Now you can select whichever scale bar style you would like for your map. For this excercise, we will (1) pick "Scale Line 2" and then (2) click OK. (If you would like to change your scale's units, click on Properties... and choose a set from the dropdown menu under Division Units.) Your new scale bar should come up on your map; (3) you can now resize it (using the points marked in blue) or change its placement by clicking inside the dotted box and dragging it.
8. Next we will add a legend so that viewers can understand our map's symbology. Once again, click on Insert at the top of the window but this time select Legend...
9. The Legend Wizard will pop-up and ask about the layers you wish to represent; since we only have one shp. file present (i.e., lct_000b16a_e) click Next to continue. (Note: If at any point in the wizard you would like how your changes affect the legend product, just click on Preview at the bottom-left corner.)
10.The wizard will then ask you about the title and its format. For this tutorial, we'll leave the default settings and click Next.
11. The next step allows you to format the legend's border, background, and drop shadow. Click on the downward arrow next to Border to see the available options; select a thickness of 1.0.
12. We can now edit the size and shape of the symbols used to represent our colors in the legend. In cases whereyou have more than one layer file, make sure you differentiate them with various shapes by clicking on the Area field. For now, we will assign a rectangle area to our only item and continue by clicking Next.
13. Now we must decide on spacing for the legend's elements - title, items, columns, headers, etc. Leave the default measurements and click Finish to see your final product.
14. The legend shows the information we wanted. Now you can change it's placement and size by dragging along the box's corners or sides. Unfortunately, the legend also shows our layer's convoluted name. To change that, we could give the layer another title in a similar way to how we changed the label in step 3 of this section and then insert a new legend. But for educational purposes, we will go through the other option: directly editing the various elements of an existing legend. Start the process by selecting and right-clicking on the legend, Select Convert to Graphics.
15. Right-click again on the legend, but this time select Ungroup. Each element in the library should now have an individual green box around it. Right-click on the one holding the layer's title (i.e. lct_000b16a_e) and click Delete. Now move the legend's elements by selecting and dragging them until you find an arrangement you like. .
17. To have the legend as it once was, click outside the map frame and hold while dragging to see a rectangular selector with which you can highlight all the elements together. Once everything you want to be part of the legend is selected, right-click on any of them and click Group.
18. Finally, we will give our map a title. Go back up to Insert, but this time click on Title.
19. In the new window, type whichever name you would like to give your map. For this excercise, we will call the map "From CHASS to ArcMap - a Tutorial", although you should use what best describes the main idea you want to communicate through our map/data. Click OK and once your title is inserted, you can drag its box to any location on the map where you think it would look best.
F. Final edits and export
- There are a couple of changes we can make to our map in case we want it to look nicer or make its surroundings clearer. First, we will add geographical references by inserting a basemap underneath our layers. Click the downward arrow next to the Add Data... button and select Add Basemap...
2. Choose any map you would like to use as background based on your preference of color and level of detail. For this excercise, we will choose Topographic.
3. Now that we have a more familiar layout of the city, its streets, and neighborhoods. let's make our color-coded symbols slightly transparent so that we can present both layers of information - our census data and the map. Right-click on the census data layer (i.e., lct_000b16a_e) on the table of contents to access Properties... and the Display tab. Set the value next to Transparent to 45 and click OK. You should now be able to discern the areas with a highest concentration of native Manadarin-speakers as well as the names of the city's major neighborhoods. (Note: if you would like to have opaque colors again, access the Display tab and set the Transparent value back to 0.)
4. To export your map as an image or PDF, go to File on the upper-left corner of your window and select Export Map...
5. In the new window, choose the location or folder you want to save your map in - browse the directory above until you find your preferred repository. Then, name the file you are about to create. Finally, choose the file type from the options shown below within the dropdown menu and click Save. (Note: depending on the format, you can also adjust the file's resolution, size, and quality, based on the options shown at the bottom of the window.)
Congratulations! You should now have a map exhibiting census data you pulled from CHASS on your own. Make sure to visit our other tutorials if you ever want to find out more about ArcMap or other data visualization tools. For additional help, visit us at the Map and Data library offices on the fifth floor of Robarts library.