Not every dataset you want to use comes as a shapefile, or in a spatial format. Often the data would come as a table or a spreadsheet and you would need to link it with your existing spatial data for use in your analysis. This operation is known as a Table Join and this tutorial will cover how to carry out table joins in QGIS.
We will use a shapefile of census tracts for California and population data table from US Census Bureau to create a population map for california.
US Census Bureau has various spatial extracts from the MAF/TIGER database. You can query and download census tracts shapefile for California. Download Census Tracts for California file.
Americal FactFinder is a repository of all census data for the US. You can use Advanced Search and query for the Topic - Total Population and Geographies - All Census Tracts in California to create a custom CSV and download it. This tutorial uses Total Population 2010 Census Summary File 1 data.
For convenience, you may directly download a copy of both the datasets from the links below:
Data Source [TIGER] [USCENSUS]
tl_2013_06_tract.zip
and select it. QGIS
can open zip files directly so no need to uncompress it first.tl_2013_06_tract.shp
layer and click OK.ca_tracts_pop.csv
in a text editor. You will notice that each row of the file contains information about a tract along with the unique identifier we saw in the previous step. Note that this field is called GEO.id2 in the CSV. You will also note that the D001 column has population value for each of the census tract.ca_tracts_pop.csvt
in the same directory as the original .csv
file. You can also download the csvt file from here.tl_2013_06_tract
layer. Right-click on it and select
Properties.ca_tracts_pop
as the
Join layer. Next we have to select the field with unique ids in
both the shapefile and the CSV. Select GEO.id2 and GEOID as the
Join field and Target field respectively. Click
OK.tl_2013_06_tract
layer and select
Open Attribute Table.tl_2013_06_tract
layer and select Properties.This work is licensed under a Creative Commons Attribution 4.0 International License