Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Get Started

Weston Platter edited this page Oct 26, 2015 · 8 revisions

This is a set of scripts for parsing 2010 U.S. Census data and importing it into a PostGIS database so that is can be more easily queried and analyzed.

Prerequisites

  • Some flavor of Unix.
  • Ruby
    • Not sure? Typing which ruby in the command line will tell if you it's installed.
  • Postgres/PostGIS
    • Not sure? Typing which psql in the command line will tell if you it's installed.

Setup

This setup will help you get up and going with census2pgsql. I'm trying to write it so that you don't have to be a hacker ninja to figure it out.

Clone the Project

  1. Open your command line terminal and change directories to where you want census2pgsql to live.
  2. Clone this project by typing git clone git://github.com/codeforamerica/census2pgsql.git. Hooray! You now have the project.

Section Summary

git clone git://github.com/codeforamerica/census2pgsql.git

Download the Raw Census Data

  1. Type cd census2pgsql to change to the project directory
  2. type mkdir data to make a new data directory. This is where we'll put the data when we're ready.
  3. Download the raw census data by typing wget -r ftp://ftp.census.gov/census_2010/01-Redistricting_File--PL_94-171/. This will put it in a directory called ftp.census.gov, basically mirroring the part of the census FTP site.
  4. The data we just downloaded is a bunch of zip files in nested directories. This isn't very easy to work with so let's copy them all into our new data directory by typing find ./ftp.census.gov -name *.zip -exec mv {} ./data/ \;.
  5. Cool, now all of the zip files are in the data directory. See? cd data; ls
  6. Let's unzip all of those files now. Make sure you're in the data directory. unzip '*.zip'

Section Summary

(copy and paste)

cd census2pgsql
mkdir data
wget -r ftp://ftp.census.gov/census_2010/01-Redistricting_File--PL_94-171/
find ./ftp.census.gov -name *.zip -exec mv {} ./data/ \;
cd data
unzip '*.zip'

Awesome! We now have census2pgsql installed and all of the census data downloaded and unzipped. We're now ready to clean up the data.