]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Updated the makefile to import TIGER block data for MD, VA, PA, and NY.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 3 Oct 2009 18:59:51 +0000 (14:59 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 3 Oct 2009 18:59:51 +0000 (14:59 -0400)
Removed quotes from some makefile variables.
Redirected psql output to /dev/null.

makefile

index 155910a68c03a8598a64c5d987999dadca886fb8..13fd41be6c2c0a3b806b1ea65e5a8f40a72ccb97 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,7 +1,13 @@
-DB_NAME='census'
-DB_USER='postgres'
-TIGER_DATA_URL='http://www2.census.gov/geo/tiger/TIGER2009/24_MARYLAND/tl_2009_24_tabblock00.zip'
-TIGER_SRID='4269'
+DB_NAME=census
+DB_USER=postgres
+TIGER_SRID=4269
+
+# URLs for the TIGER/Line block-level shapefiles.
+TIGER_ROOT=http://www2.census.gov/geo/tiger/TIGER2009
+MD_BLOCKS_URL=$(TIGER_ROOT)/24_MARYLAND/tl_2009_24_tabblock00.zip
+VA_BLOCKS_URL=$(TIGER_ROOT)/51_VIRGINIA/tl_2009_51_tabblock00.zip
+PA_BLOCKS_URL=$(TIGER_ROOT)/42_PENNSYLVANIA/tl_2009_42_tabblock00.zip
+NY_BLOCKS_URL=$(TIGER_ROOT)/36_NEW_YORK/tl_2009_36_tabblock00.zip
 
 # Starting with PostGIS 1.4.0, these paths are calculated at install
 # time using the pg_config utility. Rather than try to guess where
@@ -34,12 +40,44 @@ clean:
 # For now, we're only dealing with the Census 2000 Maryland Block
 # data, so the filenames are hard-coded. Easy enough to change.
 #
-data:
+data: tiger_blocks
+
+tiger_blocks: md_blocks va_blocks pa_blocks ny_blocks
+
+md_blocks:
        mkdir -p data/census2000/maryland/block
-       if [ ! -f data/census2000/maryland/block/tl_2009_24_tabblock00.shp ]; then \
-               wget -O tmp.zip $(TIGER_DATA_URL); \
-               unzip tmp.zip -d ./data/census2000/maryland/block; \
-               rm tmp.zip; \
+       if [ ! -f data/census2000/maryland/block/tl_2009_24_tabblock00.shp ]; \
+       then                                                                  \
+               wget -O mdblocks.zip $(MD_BLOCKS_URL);                        \
+               unzip mdblocks.zip -d ./data/census2000/maryland/block;       \
+               rm mdblocks.zip;                                              \
+       fi;
+
+va_blocks:
+       mkdir -p data/census2000/virginia/block
+       if [ ! -f data/census2000/virginia/block/tl_2009_51_tabblock00.shp ]; \
+       then                                                                  \
+               wget -O vablocks.zip $(VA_BLOCKS_URL);                        \
+               unzip vablocks.zip -d ./data/census2000/virginia/block;       \
+               rm vablocks.zip;                                              \
+       fi;
+
+pa_blocks:
+       mkdir -p data/census2000/pennsylvania/block
+       if [ ! -f data/census2000/pennsylvania/block/tl_2009_42_tabblock00.shp ]; \
+       then                                                                      \
+               wget -O pablocks.zip $(PA_BLOCKS_URL);                            \
+               unzip pablocks.zip -d ./data/census2000/pennsylvania/block;       \
+               rm pablocks.zip;                                                  \
+       fi;
+
+ny_blocks:
+       mkdir -p data/census2000/new_york/block
+       if [ ! -f data/census2000/new_york/block/tl_2009_36_tabblock00.shp ]; \
+       then                                                                  \
+               wget -O nyblocks.zip $(NY_BLOCKS_URL);                        \
+               unzip nyblocks.zip -d ./data/census2000/new_york/block;       \
+               rm nyblocks.zip;                                              \
        fi;
 
 
@@ -74,16 +112,55 @@ db: data
              -U $(DB_USER) \
              -f $(PG_SHAREDIR)/contrib/spatial_ref_sys.sql
 
-       $(PG_BINDIR)/shp2pgsql -I                                           \
-                 -s $(TIGER_SRID)                                          \
+
+# Maryland Blocks
+
+       $(PG_BINDIR)/shp2pgsql                                              \
+                 -I                                                        \
+                 -s $(TIGER_SRID)                                          \
+                 -D                                                        \
                  data/census2000/maryland/block/tl_2009_24_tabblock00.shp  \
                  tiger_blocks                                              \
+                 | psql -U $(DB_USER) -d $(DB_NAME)
+
+
+# Virginia Blocks
+
+       $(PG_BINDIR)/shp2pgsql -a                                           \
+                 -I                                                        \
+                 -s $(TIGER_SRID)                                          \
+                 -D                                                        \
+                 data/census2000/virginia/block/tl_2009_51_tabblock00.shp  \
+                 tiger_blocks                                              \
+                 | psql -U $(DB_USER) -d $(DB_NAME)
+
+
+# Pennsylvania Blocks
+
+       $(PG_BINDIR)/shp2pgsql -a                                               \
+                 -I                                                            \
+                 -s $(TIGER_SRID)                                              \
+                 -D                                                            \
+                 data/census2000/pennsylvania/block/tl_2009_42_tabblock00.shp  \
+                 tiger_blocks                                                  \
                   | psql -U $(DB_USER) -d $(DB_NAME)
 
+
+# New York Blocks
+
+       $(PG_BINDIR)/shp2pgsql -a                                           \
+                 -I                                                        \
+                 -s $(TIGER_SRID)                                          \
+                 -D                                                        \
+                 data/census2000/new_york/block/tl_2009_36_tabblock00.shp  \
+                 tiger_blocks                                              \
+                  | psql -U $(DB_USER) -d $(DB_NAME)
+
+
        psql -d $(DB_NAME) \
              -U $(DB_USER) \
              -f sql/create-sf1_blocks-table.sql
 
        bin/sf1blocks2sql src/Tests/Fixtures/SummaryFile1/mdgeo.uf1 sf1_blocks \
-                          | psql -U postgres -d $(DB_NAME)
+                          | psql -U postgres -d $(DB_NAME) > /dev/null