How to build census tract map in Tableau?
Since census tract is not a built-in geographic role in Tableau, I am googling about how to do that.
According to Tableau official tutorial on polygon maps, you need multiple (x,y) points to define a polygon to represent an area. So that’s time-consuming unless we can find polygon points data shared online.
(screenshot from the video)
Alternative solution: Use QGIS to merge points to shapes.
Available Census Tracts
1) Tiger/Line Census Tracts
Allan Walker (in response to how to access census data):
Convert/use shape files
Use shape files for boundaries:
Convert: ISRI data – Python- GIS – Tableau:
Finally, I came up with a solution for my own problem.
use files from https://tableaumapping.bi/
Step1. Understand how to use files from this website
To understand how to use files from this website, watch this video: https://tableaumapping.bi/help/
The file used in the video can be downloaded from https://tableaumapping.bi/2013/08/03/uk-local-authority-districts/
Additionally, read this blog post: http://isaacbredeson.com/index.php/2015/08/31/using-pre-joined-worksheets-to-plot-census-tract-data-in-tableau/
It provides useful info in terms of filtering only one state: “Since I want to plot only those tracts in Tennessee I need to add a filter to the data. The GEOID10 index is a concatenation of three codes: state + county + tract ID. In order to display just Tennessee I need to look up the FIPS state code and add a filter that only plots GEOID10 data that starts with ’47’. This is done by right-clicking on GEOID10 in the Marks floating tab and selecting ‘Filter…’. Select the ‘Wildcard’ tab and check ‘Starts with’ and type ’47’ into the text window.”
Step2. Download the Census Tract SED file & Tableau Workbook from https://tableaumapping.bi/2013/12/17/usa-usgs-tiger-census-tracts-2010-with-prejoined-demographic-data/
Step3. Put order ID (1,2,3,…showing the order of connecting points to form a polygon) to the Path mark and polygon ID (all points in the same polygon have the same polygon ID) to the Detail mark.
From the Tableau Workbook, I can see how the variables should be used.
point_order: the Path Mark
sub_polygon_id & Tracts_Points#csv_tracts_ID: the Detail Mark
GEOID10: the Color Mark
Step4. Filter only Missouri.
The FIPS state code for Missouri is 29. Use GEOID10 as a filter, and keep those starting with 29.
Alternative: Later, I realized that it may be even better to keep only Missouri data. So the file is much smaller and saves space.
You can do this by: right click the data source under “Data” tab, select “Extract data”, and select wildcard, start with 29.
Step5. Import another data source, and link two data files with a shared unique identifier – in this case, it’s “GEOID10” variable.
Note: I can also work on building census tracts data from the very beginning instead of using the file built by other people, but it is more time-consuming. To do that, start by step1-3 in the next section, and you’ll probably get there.
Add County Names
Download Missouri’s census tracts data from http://www.census.gov/geo/maps-data/data/tiger-line.html , following steps introduced above (Download – Web Interface – ….).
It’s .shp shape files, so I used a converting tool (http://converter.mygeodata.eu/) to convert it to .csv file.
According to FIPS codes from http://www.census.gov/geo/reference/codes/cou.html ,the COUNTYFP column shows the FIPS codes for counties.
Missouri txt file: http://www2.census.gov/geo/docs/reference/codes/files/st29_mo_cou.txt Right click – save page as a text file
In EXCEL, convert the text file to csv file. Add variable names in the first row.
Merge two files obtained from step1&2 with STATA.
After completing mapping census tracts, add new data source, and link both datasets by the common field: geoid – GEOID10.
Then add the variable countryname to the Tooltips Mark, so it will display when hovering the mouse over the map.