This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
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.
- Some flavor of Unix.
- Ruby
- Not sure? Typing
which ruby
in the command line will tell if you it's installed.
- Not sure? Typing
- Postgres/PostGIS
- Not sure? Typing
which psql
in the command line will tell if you it's installed.
- Not sure? Typing
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.
- Open your command line terminal and change directories to where you want census2pgsql to live.
- Clone this project by typing
git clone git://github.com/codeforamerica/census2pgsql.git
. Hooray! You now have the project.
git clone git://github.com/codeforamerica/census2pgsql.git
- Type
cd census2pgsql
to change to the project directory - type
mkdir data
to make a new data directory. This is where we'll put the data when we're ready. - 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 calledftp.census.gov
, basically mirroring the part of the census FTP site. - 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 typingfind ./ftp.census.gov -name *.zip -exec mv {} ./data/ \;
. - Cool, now all of the zip files are in the data directory. See?
cd data; ls
- Let's unzip all of those files now. Make sure you're in the
data
directory.unzip '*.zip'
(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.