Census Map: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 1: | Line 1: | ||
My goal is to set up a map that connects census tract data with some other census data, e.g., population or median income. | My goal is to set up a map that connects census tract data with some other census data, e.g., population or median income. | ||
This covers some of the steps necessary to do this. It is a work in progress... | |||
=Picking an API= | |||
==Census.gov API Key== | ==Census.gov API Key== | ||
| Line 17: | Line 21: | ||
A very, very nice interface! | A very, very nice interface! | ||
=Mapping Census Regions= | |||
In order to accomplish the ultimate goal of mapping census data, we have to be able to first map census regions - counties, states, congressional districts, and so on. This section covers attempts to do this. | |||
== | ==Shapefiles for U.S. Counties== | ||
I started with a shapefile defining US county boundaries. | |||
Here | Here is a list of shapefile information that is provided by the Census Bureau: http://www.census.gov/cgi-bin/geo/shapefiles2010/main | ||
I started with a county map of California, tl_2010_06_county10.zip. The zip file contained a set of files, including the shapefile. I fired up [[QGIS]] to have a look at it. | I started with a county map of California, tl_2010_06_county10.zip. The zip file contained a set of files, including the shapefile. I fired up [[QGIS]] to have a look at it. | ||
| Line 29: | Line 35: | ||
[[Image:QGIS_CaliforniaCounties.png|500px]] | [[Image:QGIS_CaliforniaCounties.png|500px]] | ||
Next, I loaded up a (quite large) US counties map - 70 MB total. It was straightforward to find, download, and view in QGIS: | |||
[[Image:QGIS_USCounties.png|500px]] | [[Image:QGIS_USCounties.png|500px]] | ||
Revision as of 05:52, 8 February 2015
My goal is to set up a map that connects census tract data with some other census data, e.g., population or median income.
This covers some of the steps necessary to do this. It is a work in progress...
Picking an API
Census.gov API Key
I started with the SunglightLabs Census library, which provides a Python wrapper to the 2010 Census data API (wow!):
https://github.com/sunlightlabs/census
But it requires a developer key from census.gov (obtained here http://www.census.gov/developers/), which I requested, and then waited, and waited, and waited...
Census Reporter API
After giving up on waiting for a Census.gov developer key in the next day, I found the census reporter API, which allows for queries of census data in a very sensible REST format.
Detailed documentation of their API available here: https://github.com/censusreporter/census-api/blob/master/API.md
A very, very nice interface!
Mapping Census Regions
In order to accomplish the ultimate goal of mapping census data, we have to be able to first map census regions - counties, states, congressional districts, and so on. This section covers attempts to do this.
Shapefiles for U.S. Counties
I started with a shapefile defining US county boundaries.
Here is a list of shapefile information that is provided by the Census Bureau: http://www.census.gov/cgi-bin/geo/shapefiles2010/main
I started with a county map of California, tl_2010_06_county10.zip. The zip file contained a set of files, including the shapefile. I fired up QGIS to have a look at it.
Next, I loaded up a (quite large) US counties map - 70 MB total. It was straightforward to find, download, and view in QGIS:
Note that you can also obtain geographic information from various APIs - for example, the Census Reporter API returns GeoJSON for geographic entities by ID:
$ curl "http://api.censusreporter.org/1.0/geo/tiger2013/04000US55?geom=true"
{
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-92.674543,
45.382868
],
...
]
]
]
},
"type": "Feature",
"properties": {
"awater": 29365986992,
"display_name": "Wisconsin",
"simple_name": "Wisconsin",
"sumlevel": "040",
"population": 5664893,
"full_geoid": "04000US55",
"aland": 140268861626
}
}