HTTPS clone URL
Subversion checkout URL
Starting from the raw census files, build a postgres db with polygons, centroids, and some other data
Fetching latest commit…
Cannot retrieve the latest commit at this time
|Failed to load latest commit information.|
This is a command-line program to build a zip-code table in a Postgresql database. To install, just clone the repository in the directory of your choice. Create a subdirectory of the repo, (I used 'unzip') and cd into it, and run the command "sh ../get-zipfiles.sh". This will pull down the zip code shape files from the census. If they change their website layout, it will require changes. Unzip the files with a command like: $ for file in * do unzip $file; echo -n $file " "; date; done go back to the repository directory, and find the information for your Postgresql database. You will need the database name, the user name, and the user password (mileage will vary depending on Postgresql configuration and authentication method used). If your database already has a table 'zips' then you're going to need to change some code, or send me an e-mail and I can allow the use of a name entered from the command line. Run the command with a command like: $ ruby create-zip.rb -d kim unzip/*.shp where unzip is the name of the directory you got the zip files into. The command will do the following: * Create the table * Load the shapefiles data into the table * For each zip code, calculate the 100 nearest zip codes based on centroids, and record them into the table. They are ordered, so if you only want the nearest 5, take the first 5 entries, etc.