• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Aug-2020-

geocode/H15-Aug-2020-1,6451,263

legacy_import/tiger2008/H15-Aug-2020-487382

normalize/H15-Aug-2020-1,318991

pagc_normalize/H15-Aug-2020-8,2398,208

regress/H15-Aug-2020-633462

tables/H15-Aug-2020-1,3331,181

topology/H15-Aug-2020-189136

utility/H15-Aug-2020-9869

COPYINGH A D15-Aug-202018 KiB340281

READMEH A D15-Aug-20204.4 KiB11180

create_geocode.batH A D15-Aug-2020945 2018

create_geocode.shH A D15-Aug-2020822 1912

create_geocode.sqlH A D15-Aug-20202.8 KiB8546

geocode_settings.sqlH A D15-Aug-20203.7 KiB7149

tiger_loader_2011.sqlH A D15-Aug-202029.2 KiB371320

tiger_loader_2012.sqlH A D15-Aug-202030.2 KiB402348

tiger_loader_2013.sqlH A D15-Aug-202030.2 KiB403350

tiger_loader_2014.sqlH A D15-Aug-202040.1 KiB569504

tiger_loader_2015.sqlH A D15-Aug-202040.2 KiB569504

tiger_loader_2016.sqlH A D15-Aug-202040.8 KiB575501

tiger_loader_2017.sqlH A D15-Aug-202041.9 KiB581523

upgrade_geocode.sqlH A D15-Aug-202011.8 KiB308234

upgrade_geocoder.batH A D15-Aug-2020624 1915

upgrade_geocoder.shH A D15-Aug-2020414 148

README

1
2Installing The Tiger Geocoder
3
4This is a customized version of Steve Frost's tiger geocoder revisions.
5
6This version includes a loader that is portable between Linux and
7Windows but loads a full state of data at a time.  The loader helper tables and
8functions are prefixed with loader and stored in the tiger schema.  If
9you only want to load a county, revise the wget call that is generated
10for the state to just download the statewide and specific counties or
11just download them by hand.  The loader will only process files that
12exist.
13
14If you are on windows, you will need 7zip and wget.  7zip you can get
15from http://www.7-zip.org/ and wget you can get from
16http://gnuwin32.sourceforge.net/packages/wget.htm
17
18Tiger Geocoder is now part of the PostGIS documentation
19for further details about function use, refer to:
20http://postgis.net/docs/manual-dev/Extras.html#Tiger_Geocoder
21
22Refer to http://postgis.net/docs/manual-dev/postgis_installation.html#install_tiger_geocoder_extension
23for installing, upgrading, and loading data from extensions.
24
25Note that installing by script approach is now deprecated, but covered in:
26http://postgis.net/docs/manual-dev/postgis_installation.html#install_tiger_geocoder
27
28Loading data:
29
301. Create a folder called gisdata on root of server or your local pc
31if you have a fast network connection to the server. This folder is
32where the tiger files will be downloaded to.
33
342. Create a folder called temp in the gisdata folder.  This will be
35the folder where we extract the downloaded tiger data.
36
373. Run the following commands at psql or pgAdmin III query window to
38generate the script, replacing 'DC', 'RI' with list of states you want
39and save contents to a .bat or sh file in YOUR CURRENT DIRECTORY. This
40will generate CODE for each state and append it to the script.
41
42(IF YOU ARE AT A PSQL PROMPT, FIRST RUN "\a", "\t", AND "\o
43script.xxx".  THIS WILL MAKE YOUR OUTPUT UNALIGNED AND REDIRECT IT TO
44script.xxx.  WITHOUT "\a" and "\t", THE SCRIPT WILL HAVE EXTRA
45WHITESPACE AND POSSIBLY NON-SCRIPT CHARACTERS THAT CAUSE IT TO BREAK.)
46
47-- UNIX /LINUX USERS --
48-- Note even if you want just specific states you need to
49-- do this step since 2015 county, state tables are available only at national level
50SELECT loader_generate_nation_script('sh');
51
52-- After the nation load, generate a bash script suitable for Unix command lines
53-- for your desired states.
54
55SELECT loader_generate_script(ARRAY['DC','RI'], 'sh');
56
57
58ONCE YOU GENERATE THIS SCRIPT, EDIT IT TO ADD "set -e -u" AT THE TOP;
59THIS SETTING WILL MAKE IT STOP ON ERROR OR UNITIALIZED VARIABLE AND
60MAKE IT EASIER TO DEBUG ANY PROBLEMS.
61THEN RUN THE SCRIPT AT THE COMMAND LINE, REDIRECTING STANDARD OUTPUT AND
62STANDARD ERROR TO USEFUL FILES.  YOU MAY WANT TO RUN "tail -f " TO SEE THE
63STANDARD ERROR AS IT GETS WRITTEN.  FOR EXAMPLE:
64
65$ sh foo.sh 1>out 2>err; tail -f err
66
67-- WINDOWS USERS --
68--To generate a WINDOWS DOS script
69-- this will generate the script to download the national layers
70-- Note even if you want just specific states you need to
71-- do this step since 2011 county, state tables are available only at national level
72SELECT loader_generate_nation_script('windows');
73
74-- this you do after the nation load and for states you want
75SELECT loader_generate_script(ARRAY['DC','RI'], 'windows');
76
77If your script disappears without loading anything,
78most likely one of your path settings is wrong.
79To troubleshoot run the batch script by
80first opening up a commandline and executing the file.
81
82That will keep the window open for you to see the error.
83
84-- Next run the script to install any missing indexes --
85SELECT install_missing_indexes();
86
87Alternatively if you want to see what indexes will be created before
88you create them run the below and manually run the steps generated:
89SELECT missing_indexes_generate_script();
90
91
929. Copy and paste the generated script into a .bat or .sh file and put
93in gisdata folder you created and then run it, OR IF YOU REDIRECTED
94THE OUTPUT TO A FILE WITH "\o" MOVE THAT FILE TO GISDATA.
95
9610. Test out the geocoder run these queries
97
98-- To get the best rated answer --
99-- this is generally faster
100SELECT g.rating,
101	ST_X(geomout) As lon,
102	ST_Y(geomout) As lat, (addy).*
103FROM geocode('1731 New Hampshire Avenue Northwest, Washington, DC 20010', 1) As g;
104
105--To get multiple answers if there is more than 1
106SELECT g.rating,
107	ST_X(geomout) As lon,
108	ST_Y(geomout) As lat, (addy).*
109FROM geocode('1731 New Hampshire Avenue Northwest, Washington, DC 20010') As g;
110
111