TIGER Geocoder

2007/07/03 install instructions:

- Install postgresql-8.2-postgis (For various GIS bits)
- Install PostGIS functions and spatial ref definitions:
  \i /usr/share/postgresql-8.2-postgis/postgis.sql
  \i /usr/share/postgresql-8.2-postgis/spatial_ref_sys.sql
- Install postgresql-contrib-8.2 for soundex (from fuzzystrmatch)
- Install functions into PG using:
  \i /usr/share/postgresql/8.2/contrib/fuzzystrmatch.sql
- Modify and run import/load_tiger.sh for TIGER/Line data
  (May wish to run the CompleteChain import seperate from the
  Polygon import, since the latter takes an enourmous amount of time)
- Rename tables to be lower-case and whatnot
- Run ogr2ogr (example from tigerimport.sh called from load_tiger.sh)
  for the TIGER Boundary SHP files (state boundaries, county boundaries, etc).
  Might want download them into boundary/

  Single-file import something like this:
  ogr2ogr -append -f PostgreSQL -a_srs EPSG:4269 "PG:dbname=mydb user=tiger password=XXXXXXXX" WHATEVER.shp WHATEVER -lco DIM=2

  Script to import the multi-file sets into a single table:
  for file in *; do
    mkdir x
    cd x
    unzip ../$file
    BASE=`echo *.shp | cut -f1 -d.`
    ogr2ogr -append -f PostgreSQL -a_srs EPSG:4269 "PG:dbname=mydb user=tiger password=XXXXXXXX" $BASE.shp $BASE -nln vt99_d00 -lco DIM=2
    cd ..
    rm -rf x
  done

- Create geometry indexes on all the tables using GiST, eg:
  CREATE INDEX completechain_geom_idx ON completechain
  USING GIST (wkb_geometry public.gist_geometry_ops);
- Create lookup tables using lookup_tables.sql
- Create roads_local using roads_local.sql
- Create 'tiger_geocode_roads' using tiger_geocode_roads.sql
- Run create_geocode.sql to load the functions
- Profit!

Old install instructions:

  2004/10/28

  A plpgsql based geocoder written for TIGER census data.

Installation instructions:

- If the database being used is new, ensure the following scripts have 
  been loaded:

	/opt/pgsql74/share/postgis.sql
	/opt/pgsql74/share/contrib/spatial_ref_sys.sql

- Load the fuzzy string matching functions.  These must first be compiled, 
  and may be found in the contrib directory of the postgres source directory.

	psql [-p (port)] (database) < /usr/local/src/postgresql-7.4.5/contrib/fuzzystrmatch/fuzzystrmatch.sql

- Ensure that the TIGER data is loaded into the target database.

- Load the lookup tables.  This creates the lookup tables and loads predefined
  data into them.  If the standardized TIGER data is not being used, this 
  script will need to be altered to reflect the actual data.  Since the place
  and countysub lookup tables are generated to reflect the data in use, the
  database must be populated before this script is run.  Indicies are also
  created in this script.

	psql [-p (port)] (database) < lookup_tables.sql

- Load the function scripts.  This script loads the geocode function, and all
  support modules and functions required by it.

	psql [-p (port)] (database) < tiger_geocoder.sql
