Accessing Dissemination Area stats
We are going to download some census data for Dissemination Areas (DA) for BC. This will work for our attribute data for working with DA polygons in the labs and perhaps for student projects.
Using Census Analyzer
You can connect to the University of Toronto Census Analyzer via the UNBC website and download the data by:
- Go to the UNBC Library Website
- Open the Library Pages
-Collections
– Data and Statistics - Choose the Census tab
– Below the Canadian Census Data in the Census of Population section
– Click the Census Analyzer tab. - Click on Canadian census analyser @ CHASS
- Login using your UNBC credentials
- Choose Enumeration area / Dissemination area
– 2016 - Select out census values for BC with the following criteria:
- Step 1
- uncheck all under the “by Name” tab
- Select BC under the “by Province” tab
- check all census divisions
- Step 2
- Total Population, 2016 – under Population and Dwellings
- Under the “Labour” tab, On the “Total Sex” tab, select
- Total – Population aged 15 years and over that are employed (25%)
- In the labour force
- Employed
- Unemployed
- Not in the labour force
- Step 3
- CD Name
- Census variables to be listed as columns
- Choose “none” for file compression. A zip file is not necessary for our purposes
- Download to a file – CSV for spreadsheet
- Submit Query
- You will now have two files: a csv file and a txt file with the descriptions of the column headers
- Step 1
Organize and Clean up your data
- Open the CSV file.
- Using the header text file, name your columns appropriately. i.e. replace Col0, Col1 with meaningful column names. PLEASE assign names that are 8 characters or less (a shapefile limitation)
- Next sort by the columns by the dissemination area ID and delete all the rows where the ID that is 4 characters long.
- Click at the top of the column to select the whole column
- On the Home tab, Editing group, Sort and Filter, Smallest to Largest. Make sure you choose Expand Selection to include all the data
- Why do you think we have to remove these rows?
- Save your CSV file in an appropriate folder on the K drive
Acquiring Dissemination Area Geography Files (boundary files)
- Got to: https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm
- Choose ArcGIS format
- In the Boundary files section, under the Cartographic Boundary File column, choose the Dissemination areas row
- Click Continue and download the zip file. Save it to your K drive. This Zip file is a shapefile that contains the boundaries of all the dissemination areas in Canada for the 2016 census.
- Right click on the zip file and choose Extract All…
- You should have a new folder with the shapefile in it. Open this shapefile in QGIS.
- In QGIS, right click and Open the Attribute Table
- Using the Select/filter button (or Ctrl+F), select features where the PRUID is 59
- Export the selection and save it as a shapefile, using EPSG 3347 coordinate system. Add it as a layer in QGIS
- Add the CSV file you downloaded and whose columns you labeled appropriately with the Statistics Canada data to QGIS
Join the CSV to the Shapefile
In order to perform a “Join” you need a common field in both files. In the shapefile, the DAUID is the same as the column with the dissemination IDs in CSV. However, the two fields are of different data types: one is numeric the other is string. The data types need to match for us to do the join. For this we will now create a numeric field in for the DAUID in the shapefile.
- Open the attribute table for the shapefile and Click the Edit button
- Click the New Field button. Give your new field a name: DAUID_I Make sure it is of Whole Integer data type. Length 10 is fine.
- Select the Open Field Calculator button. Choose the Update existing field option and specify DAUID_I and DAUID under the Expression tab.
- Save Edits and get out of the editing mode (Toggle Editing mode)
- Right Click on the shapefile, Choose Properties >> Joins
- Click the Plus sign in the bottom left hand corner
- Join Layer is your CSV
- Join Field is the dissemination area ID field in your csv
- Target Field is the DAUD_I in the shapefile.
- Click OK and Toggle Editing to save your work
- Look through the attribute fields to make sure that the DAUID and DAUID_I match.
- Please show me your work at this point. Save your project (.qgz). We will continue from here next week.