Build Census Tract Map in Tableau

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.

example1

Capture (screenshot from the video)

 

example2

http://venkat-echo.blogspot.com.au/2013/09/tableau-maps-custom-shapes-polygon.html

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):

http://www.census.gov/geo/maps-data/data/tiger-line.html
-> Download

-> Web interface

-> Select a layer type

-> Census Tracts

-> Select a state

Source:  https://community.tableau.com/ideas/2492

2) Tableau Mapping

Tableau Mapping: https://tableaumapping.bi/

Repository – USA: https://tableaumapping.bi/category/usa/

Found it from this post on Tableau forum: https://community.tableau.com/thread/129587

 

Convert/use shape files

Use shape files for boundaries:

https://blog.databender.net/2015/02/06/using-shape-files-for-boundaries-in-tableau/

Convert: ISRI data – Python- GIS – Tableau:

http://venkat-echo.blogspot.com/2013/09/tableau-convert-esri-shapes-into.html

Convert tools:

http://converter.mygeodata.eu/

http://www.safe.com/

———————————————-

Finally, I came up with a solution for my own problem.

Solution

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

AVG([Tracts_Points#csv_Longitude]): Columns

AVG([Tracts_Points#csv_Latitude]): Rows

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

Step1.

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.

Step2.

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.

Step3.

Merge two files obtained from step1&2 with STATA.

Step4.

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s