Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a little documentation

  • Loading branch information...
commit 18de79ebc17bd3aae81f8fc269f4d73631c5d506 1 parent 79c8b63
@JoeGermuska JoeGermuska authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 tools/sql/ire_export/load_psql.sh
View
15 tools/sql/ire_export/load_psql.sh
@@ -1,10 +1,23 @@
#!/usr/bin/env bash
+# usage: ./load_psql.sh [TABLE CODE] [STATE FIPS CODE] [SUMMARY LEVEL]
+# supports all 331 Census 2010 tables
+# only the five summary levels supported by the IRE Census app:
+# 040 State
+# 050 County
+# 060 County Subdivision
+# 140 Census Tract
+# 160 Place
+# see also http://census.ire.org/data/bulkdata.html
+# list of FIPS state codes at http://en.wikipedia.org/wiki/Federal_Information_Processing_Standard_state_code#FIPS_state_codes
+
+# change this to your default database, or tweak the script to make it a parameter
+DATABASE='nicar'
+
TABLE=$1
STATE=$2
SUMLEV=$3
LOWER_TABLE=`echo $TABLE | tr '[A-Z]' '[a-z]'`
-DATABASE='nicar'
echo table $TABLE state $STATE sumlev $SUMLEV
curl https://raw.github.com/ireapps/census/master/tools/sql/ire_export/ire_${TABLE}.sql | psql $DATABASE
curl http://censusdata.ire.org/${STATE}/all_${SUMLEV}_in_${STATE}.${TABLE}.csv | gzcat > all_${SUMLEV}_in_${STATE}.${TABLE}.csv
Please sign in to comment.
Something went wrong with that request. Please try again.