You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "You must set PGHOST environment variable to the hostname of the PostgreSQL server to operate on."
exit 1
fi
psql -d census -U census -v ON_ERROR_STOP=1 -q -c "DROP SCHEMA IF EXISTS tiger2015 CASCADE; CREATE SCHEMA tiger2015;"
psql -d census -U census -v ON_ERROR_STOP=1 -q -c "ALTER SCHEMA tiger2015 OWNER TO census;"
for i in CBSA CD COUNTY CSA PLACE STATE ELSD SCSD ZCTA5 COUSUB PUMA SLDL SLDU AIANNH AITS ANRC BG CNECTA CONCITY METDIV NECTA NECTADIV SUBMCD TBG TTRACT TABBLOCK TRACT UAC UNSD
do
for j in $i/*.zip
do
unzip -q -n $j -d $i
done
# Pick one of the shapefiles to build schema with
one_shapefile=`ls -a $i/*.shp | head -n 1`
# Start by preparing the table
shp2pgsql -W "latin1" -s 4326 -p -I $one_shapefile tiger2015.$i | psql -d census -U census -v ON_ERROR_STOP=1 -q
# Then append all the geometries
for j in $i/*.shp
do
shp2pgsql -W "latin1" -s 4326 -a $j tiger2015.$i | psql -d census -U census -v ON_ERROR_STOP=1 -q