Loading TIGER polygons tigerpoly.pl
This is legacy documentation, see the parent page Loading TIGER polygons for the recommended loading instructions.
create the poly.shp file
NOTE: If you are doing the postgresql load and this load at the same time you must make a copy of the uncompressed tiger files. This process creates shapefiles in the tiger data directories. The sql loader will attempt to load them into the database. This will make your day terrible!
for i in tgr* do cd $i echo $i python ~/python/tigerpoly.py . cd .. done
NOTE: on a two processor machine, you can run two of these at the same time (recommended). Use "foreach i (tgr0* tgr1* tgr2*)" and "foreach i (tgr3* tgr4* tgr5* tgr6* tgr7*)"
4. load into postgis:
do this for 1st one only:
shp2pgsql -s 1 -i -D poly poly | /spare/local/usr/bin/psql tiger2004se
for all others:
shp2pgsql -a -s 1 -D poly poly | /spare/local/usr/bin/psql tiger2004se
or you can (on windows):
shp2pgsql -s 1 poly poly > poly.sql psql new_tiger -U cite (password) \i poly.sql
foreach i (tgr0* tgr1* tgr2* tgr3* tgr4* tgr5* tgr6* tgr7* tgr8* tgr9* ) cd $i echo $i shp2pgsql -a -s 1 -D poly poly | /spare/local/usr/bin/psql tiger2004se cd .. end
5. build indexes
CREATE INDEX cc_module_idx on completechain (module); CREATE INDEX poly_module_idx on poly (module); CREATE INDEX poly_polyid_idx on poly (polyid); CREATE INDEX lm_module_idx on landmarks (module); CREATE INDEX alm_module_idx on arealandmarks (module); analyse;
6. FIX POLYGONS
tigerpoly.py creates topologically incorrect polygons. This process should correct them all.
USE AT OWN RISK == THIS HASNT BEEN TESTED!