File: installation.xml

package info (click to toggle)
postgis 3.5.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 69,540 kB
  • sloc: ansic: 162,229; sql: 93,960; xml: 53,139; cpp: 12,646; perl: 5,658; sh: 5,369; makefile: 3,435; python: 1,205; yacc: 447; lex: 151; pascal: 58
file content (1229 lines) | stat: -rw-r--r-- 53,822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
<!-- Converted by db4-upgrade version 1.1 -->
<chapter xmlns="http://docbook.org/ns/docbook"
 xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="postgis_installation">
  <title>PostGIS Installation</title>

  <para>
	This chapter details the steps required to install PostGIS.
  </para>

  <section xml:id="install_short_version">
	<title>Short Version</title>
	<para>To compile assuming you have all the dependencies in your search path:</para>
	<programlisting>tar -xvzf postgis-&last_release_version;.tar.gz
cd postgis-&last_release_version;
./configure
make
make install</programlisting>
	<para>
Once PostGIS is installed, it needs to be
enabled (<xref linkend="create_spatial_db"/>)
or upgraded (<xref linkend="upgrading"/>)
in each individual database you want to use it in.
  </para>

  </section>

  <section xml:id="PGInstall">
	<title>Compiling and Install from Source</title>

	<note>
	  <para>
		Many OS systems now include pre-built packages for PostgreSQL/PostGIS.
		In many cases compilation is only necessary if you want the most
		bleeding edge versions or you are a package maintainer.
	  </para>
	  <para>This section includes general compilation instructions, if you are compiling for Windows etc
		or another OS, you may find additional more detailed help at <link xlink:href="https://trac.osgeo.org/postgis/wiki/UsersWikiInstall">PostGIS User contributed compile guides</link> and <link xlink:href="http://trac.osgeo.org/postgis/wiki/DevWikiMain">PostGIS Dev Wiki</link>.</para>
	  <para>Pre-Built Packages for various OS are listed in <link xlink:href="https://trac.osgeo.org/postgis/wiki/UsersWikiPackages">PostGIS Pre-built Packages</link></para>
	  <para>If you are a windows user, you can get stable builds via Stackbuilder or <link xlink:href="https://postgis.net/windows_downloads">PostGIS Windows download site</link>
	  We also have <link xlink:href="https://postgis.net/windows_downloads">very bleeding-edge windows experimental builds</link> that are built usually once or twice a week or whenever anything exciting happens.  You can
	  use these to experiment with the in progress releases of PostGIS</para>
	</note>

	<para>
	  The PostGIS module is an extension to the PostgreSQL backend server. As
	  such, PostGIS &last_release_version; <emphasis>requires</emphasis> full
	  PostgreSQL server headers access in order to compile. It can be built
	  against PostgreSQL versions &min_postgres_version; - &max_postgres_version;. Earlier
	  versions of PostgreSQL are <emphasis>not</emphasis> supported.
	</para>

	<para>
	  Refer to the PostgreSQL installation guides if you haven't already
	  installed PostgreSQL.
	  <link xlink:href="https://www.postgresql.org">
		https://www.postgresql.org
	  </link>
	  .
	</para>

	<note>
	  <para>
		For GEOS functionality, when you install PostgreSQL you may need to
		explicitly link PostgreSQL against the standard C++ library:
	  </para>

	  <programlisting>LDFLAGS=-lstdc++ ./configure [YOUR OPTIONS HERE]</programlisting>

	  <para>
		This is a workaround for bogus C++ exceptions interaction with older
		development tools. If you experience weird problems (backend
		unexpectedly closed or similar things) try this trick. This will require
		recompiling your PostgreSQL from scratch, of course.
	  </para>
	</note>

	<para>
	  The following steps outline the configuration and compilation of the
	  PostGIS source. They are written for Linux users and will not work on
	  Windows or Mac.
	</para>

  <section xml:id="install_getting_source">
	<title>Getting the Source</title>

	<para>
	  Retrieve the PostGIS source archive from the downloads website
	  <link xlink:href="&postgis_download_url;">
		&postgis_download_url;
	  </link>
	</para>

	<programlisting>wget &postgis_download_url;
tar -xvzf postgis-&last_release_version;.tar.gz
cd postgis-&last_release_version;</programlisting>

	<para>
	  This will create a directory called
	  <varname>postgis-&last_release_version;</varname> in the current working
	  directory.
	</para>

	<para>
	  Alternatively, checkout the source from the
	  <link xlink:href="https://git-scm.com/">
		git
	  </link>
	  repository
	  <link xlink:href="https://git.osgeo.org/gitea/postgis/postgis/">
		https://git.osgeo.org/gitea/postgis/postgis/
	  </link>
	  .
	</para>

	<programlisting>git clone https://git.osgeo.org/gitea/postgis/postgis.git postgis
cd postgis
sh autogen.sh
    </programlisting>

	<para>
	  Change into the newly created
	  <varname>postgis</varname> directory to continue
	  the installation.
	</para>
    <programlisting>./configure</programlisting>
  </section>

  <section xml:id="install_requirements">
	<title>Install Requirements</title>

	<para>
	  PostGIS has the following requirements for building and usage:
	</para>

	<para>
	  <emphasis role="bold">Required</emphasis>
	</para>

	<itemizedlist>
	  <listitem>
		<para>
		  PostgreSQL &min_postgres_version; - &max_postgres_version;. A complete installation
		  of PostgreSQL (including server headers) is required. PostgreSQL
		  is available from
		  <link xlink:href="https://www.postgresql.org">
			https://www.postgresql.org
		  </link>
		  .
		</para>
		<para>For a full PostgreSQL / PostGIS support matrix and PostGIS/GEOS support matrix refer to
			<link xlink:href="https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS">https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS</link>
		</para>
	  </listitem>

	  <listitem>
		<para>
		  GNU C compiler (<filename>gcc</filename>). Some other ANSI C compilers
		  can be used to compile PostGIS, but we find far fewer problems when
		  compiling with <filename>gcc</filename>.
		</para>
	  </listitem>

	  <listitem>
		<para>
		  GNU Make (<filename>gmake</filename> or <filename>make</filename>).
		  For many systems, GNU <filename>make</filename> is the default version
		  of make. Check the version by invoking <filename>make -v</filename>.
		  Other versions of <filename>make</filename> may not process the
		  PostGIS <filename>Makefile</filename> properly.
		</para>
	  </listitem>

	  <listitem>
		<para>
		  Proj reprojection library. Proj 6.1 or above is required.
			The Proj library is used to provide coordinate reprojection support within
		  PostGIS. Proj is available for download from
		  <link xlink:href="https://proj.org/">
			https://proj.org/
		  </link>
		  .
		</para>
	  </listitem>

	  <listitem>
		<para>
		  GEOS geometry library, version &min_geos_version; or greater, but GEOS 3.12+ is required to take full advantage of all the new functions and features. GEOS is available for download from
		  <link xlink:href="https://libgeos.org/">
			https://libgeos.org
		  </link>.
		</para>
	  </listitem>
	  <listitem>
		<para>
		  LibXML2, version 2.5.x or higher. LibXML2 is currently used in some imports
		  functions (ST_GeomFromGML and ST_GeomFromKML). LibXML2 is available for download from
		  <link xlink:href="https://gitlab.gnome.org/GNOME/libxml2/-/releases">https://gitlab.gnome.org/GNOME/libxml2/-/releases</link>.
		</para>
	  </listitem>
	  <listitem>
		<para>
		  JSON-C, version 0.9 or higher. JSON-C is currently used to import GeoJSON via the
		  function ST_GeomFromGeoJson. JSON-C is available for download from
		  <link xlink:href="https://github.com/json-c/json-c/releases">https://github.com/json-c/json-c/releases/</link>.
		</para>
	  </listitem>

	  <listitem>
		<para>
		  GDAL, version 3+ is preferred.  This is required for raster
      support.
		  <link xlink:href="https://gdal.org/download.html">https://gdal.org/download.html</link>.
		</para>
	  </listitem>

		<listitem>
		<para>
		  If compiling with PostgreSQL+JIT, LLVM version &gt;=6 is required
		  <link xlink:href="https://trac.osgeo.org/postgis/ticket/4125">https://trac.osgeo.org/postgis/ticket/4125</link>.
		</para>
	  </listitem>

	</itemizedlist>

	<para>
	  <emphasis role="bold">Optional</emphasis>
	</para>

	<itemizedlist>
	  <listitem>
		<para>
		  GDAL (pseudo optional) only if you don't want raster
		  you can leave it out.  Also make sure to enable
		  the drivers you want to use as described in <xref linkend="raster_configuration"/>.
    </para>
	  </listitem>
	  <listitem>
		<para>
		  GTK (requires GTK+2.0, 2.8+) to compile the shp2pgsql-gui shape file loader.
		  <link xlink:href="http://www.gtk.org/">
			http://www.gtk.org/
		  </link>
		  .
		</para>
	  </listitem>

	  <listitem>
		<para>
			SFCGAL, 1.4.1 or higher is required and 1.5.0+ is needed to be able to use all functionality. SFCGAL can be used to provide additional 2D and 3D advanced analysis functions to PostGIS cf <xref linkend="reference_sfcgal"/>. And also allow to use SFCGAL rather than GEOS for some 2D functions provided by both backends (like ST_Intersection or ST_Area, for instance). A PostgreSQL configuration variable <code>postgis.backend</code> allow end user to control which backend he want to use if SFCGAL is installed (GEOS by default). Nota: SFCGAL 1.2 require at least CGAL 4.3 and Boost 1.54 (cf: <link xlink:href="https://sfcgal.org">https://sfcgal.org</link>)

		  <link xlink:href="https://gitlab.com/sfcgal/SFCGAL/">https://gitlab.com/sfcgal/SFCGAL/</link>.
		</para>
	  </listitem>

	 <listitem>
			<para>
				In order to build the <xref linkend="Address_Standardizer"/> you will also need PCRE <link xlink:href="http://www.pcre.org">http://www.pcre.org</link> (which generally is already installed on nix systems).
				<xref linkend="Address_Standardizer"/> will automatically be built if it detects a PCRE library, or you pass in a valid <varname>--with-pcre-dir=/path/to/pcre</varname> during configure.
			</para>
		</listitem>

		<listitem>
			<para>
			  To enable ST_AsMVT protobuf-c library 1.1.0 or higher (for usage) and the protoc-c compiler (for building) are required.
				Also, pkg-config is required to verify the correct minimum version of protobuf-c.
				See <link xlink:href="https://github.com/protobuf-c/protobuf-c">protobuf-c</link>.
				By default, Postgis will use Wagyu to validate MVT polygons faster which requires a c++11 compiler. It will use CXXFLAGS and the same compiler as the PostgreSQL installation. To disable this and use GEOS instead use the <varname>--without-wagyu</varname> during the configure step.
			</para>
		</listitem>

	  <listitem>
		<para>
		 CUnit (<filename>CUnit</filename>). This is needed for regression testing. <link xlink:href="http://cunit.sourceforge.net/">http://cunit.sourceforge.net/</link>
		</para>
	  </listitem>

	  <listitem>
		<para>
		  DocBook (<filename>xsltproc</filename>) is required for building the
		  documentation. Docbook is available from
		  <link xlink:href="http://www.docbook.org/">
			http://www.docbook.org/
		  </link>
		  .
		</para>
	  </listitem>

	  <listitem>
		<para>
		  DBLatex (<filename>dblatex</filename>) is required for building the
		  documentation in PDF format. DBLatex is available from
		  <link xlink:href="http://dblatex.sourceforge.net/">
			http://dblatex.sourceforge.net/
		  </link>
		  .
		</para>
	  </listitem>

	  <listitem>
		<para>
		  ImageMagick (<filename>convert</filename>) is required to generate the
		  images used in the documentation. ImageMagick is available from
		  <link xlink:href="http://www.imagemagick.org/">
			http://www.imagemagick.org/
		  </link>
		  .
		</para>
	  </listitem>
	</itemizedlist>
  </section>


	<section xml:id="installation_configuration">
	  <title>Build configuration</title>

	  <para>
		As with most linux installations, the first step is to generate the
		Makefile that will be used to build the source code. This is done by
		running the shell script
	  </para>

	  <para>
		<command>./configure</command>
	  </para>

	  <para>
		With no additional parameters, this command will attempt to
		automatically locate the required components and libraries needed to
		build the PostGIS source code on your system. Although this is the most
		common usage of <command>./configure</command>, the script accepts
		several parameters for those who have the required libraries and
		programs in non-standard locations.
	  </para>
	  <para>
		The following list shows only the most commonly used parameters. For a
		complete list, use the <command>--help</command> or
		<command>--help=short</command> parameters.
	  </para>

	  <variablelist>
		<varlistentry>
		  <term><option>--with-library-minor-version</option></term>
		  <listitem>
			<para>Starting with PostGIS 3.0, the library files generated by default will no longer have the minor version
			as part of the file name.  This means all PostGIS 3 libs will end in <code>postgis-3</code>.
			This was done to make pg_upgrade easier, with downside that you can only install
			one version PostGIS 3 series in your server.
			To get the old behavior of file including the minor version: e.g. <code>postgis-3.0</code>
			add this switch to your configure statement.</para>

		  </listitem>
		</varlistentry>


		<varlistentry>

		  <term><option>--prefix=PREFIX</option></term>
		  <listitem>
			<para>
			  This is the location the PostGIS loader executables and shared libs will be installed.
				By default, this location is the same as the
			  detected PostgreSQL installation.
			</para>

			<caution>
			  <para>
				This parameter is currently broken, as the package will only
				install into the PostgreSQL installation directory. Visit
				<link xlink:href="http://trac.osgeo.org/postgis/ticket/635">
				  http://trac.osgeo.org/postgis/ticket/635
				</link>
				to track this bug.
			  </para>
			</caution>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-pgconfig=FILE</option></term>
		  <listitem>
			<para>
			  PostgreSQL provides a utility called <command>pg_config</command>
			  to enable extensions like PostGIS to locate the PostgreSQL
			  installation directory. Use this parameter
			  (<command>--with-pgconfig=/path/to/pg_config</command>) to
			  manually specify a particular PostgreSQL installation that PostGIS
			  will build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-gdalconfig=FILE</option></term>
		  <listitem>
			<para>
			  GDAL, a required library, provides functionality needed for raster support
			  <command>gdal-config</command> to enable software installations to
			  locate the GDAL installation directory. Use this parameter
			  (<command>--with-gdalconfig=/path/to/gdal-config</command>) to
			  manually specify a particular GDAL installation that PostGIS will
			  build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-geosconfig=FILE</option></term>
		  <listitem>
			<para>
			  GEOS, a required geometry library, provides a utility called
			  <command>geos-config</command> to enable software installations to
			  locate the GEOS installation directory. Use this parameter
			  (<command>--with-geosconfig=/path/to/geos-config</command>) to
			  manually specify a particular GEOS installation that PostGIS will
			  build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-xml2config=FILE</option></term>
		  <listitem>
			<para>
			  LibXML is the library required for doing GeomFromKML/GML processes.
			  It normally is found if you have libxml installed, but if not or you want
			  a specific version used, you'll need to point PostGIS at a specific
			  <filename>xml2-config</filename> confi file to enable software installations to
			  locate the LibXML installation directory. Use this parameter
			  (<command>&gt;--with-xml2config=/path/to/xml2-config</command>) to
			  manually specify a particular LibXML installation that PostGIS will
			  build against.
			</para>
		  </listitem>
		</varlistentry>



		<varlistentry>
		  <term><option>--with-projdir=DIR</option></term>
		  <listitem>
			<para>
			  Proj is a reprojection library required by PostGIS. Use this
			  parameter (<command>--with-projdir=/path/to/projdir</command>) to
			  manually specify a particular Proj installation directory that
			  PostGIS will build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-libiconv=DIR</option></term>
		  <listitem>
			<para>
			  Directory where iconv is installed.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-jsondir=DIR</option></term>
		  <listitem>
			<para>
			  <link xlink:href="http://oss.metaparadigm.com/json-c/">JSON-C</link> is an MIT-licensed JSON library required by PostGIS ST_GeomFromJSON support. Use this
			  parameter (<command>--with-jsondir=/path/to/jsondir</command>) to
			  manually specify a particular JSON-C installation directory that
			  PostGIS will build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-pcredir=DIR</option></term>
		  <listitem>
			<para>
			  <link xlink:href="http://www.pcre.org/">PCRE</link> is an BSD-licensed Perl Compatible Regular Expression library required by address_standardizer extension. Use this
			  parameter (<command>--with-pcredir=/path/to/pcredir</command>) to
			  manually specify a particular PCRE installation directory that
			  PostGIS will build against.
			</para>
		  </listitem>
		</varlistentry>

		<varlistentry>
		  <term><option>--with-gui</option></term>
		  <listitem>
			<para>
			  Compile the data import GUI (requires GTK+2.0).  This will create shp2pgsql-gui graphical interface
			  to shp2pgsql.
			</para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><option>--without-raster</option></term>
		  <listitem>
			<para>
			  Compile without raster support.
      </para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><option>--without-topology</option></term>
		  <listitem>
			<para>
			  Disable topology support. There is no corresponding library
			  as all logic needed for topology is in postgis-&last_release_version; library.
			</para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><option>--with-gettext=no</option></term>
		  <listitem>
			<para>
			  By default PostGIS will try to detect gettext support and compile with it, however if you run into incompatibility issues that
			  cause breakage of loader, you can disable it entirely with this command.  Refer to ticket <link xlink:href="http://trac.osgeo.org/postgis/ticket/748">http://trac.osgeo.org/postgis/ticket/748</link> for an example issue solved by configuring with this.
			  NOTE: that you aren't missing much by turning this off.  This is used for international help/label support for the GUI loader which is not yet documented
			  and still experimental.
			</para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><option>--with-sfcgal=PATH</option></term>
		  <listitem>
			<para>
			  By default PostGIS will not install with sfcgal support without this switch.
			  <varname>PATH</varname> is an optional argument that allows to specify an alternate PATH to sfcgal-config.
			</para>
		  </listitem>
		</varlistentry>
		<varlistentry>
		  <term><option>--without-phony-revision</option></term>
		  <listitem>
			<para>
			  Disable updating postgis_revision.h to match current HEAD of the git repository.
			</para>
		  </listitem>
		</varlistentry>
	  </variablelist>
	  <note>
		<para>
		  If you obtained PostGIS from the
		  <link xlink:href="https://trac.osgeo.org/postgis/wiki/CodeRepository">
			code repository
		  </link>
		  , the first step is really to run the script
		</para>

		<para>
		  <command>./autogen.sh</command>
		</para>

		<para>
		  This script will generate the <command>configure</command> script that
		  in turn is used to customize the installation of PostGIS.
		</para>

		<para>
		  If you instead obtained PostGIS as a tarball, running
		  <command>./autogen.sh</command> is not necessary as
		  <command>configure</command> has already been generated.
		</para>
	  </note>
	</section>

	<section>
	  <title>Building</title>

	  <para>
		Once the Makefile has been generated, building PostGIS is as simple as
		running
	  </para>

	  <para>
		<command>make</command>
	  </para>

	  <para>
		The last line of the output should be "<code>PostGIS was built
		successfully. Ready to install.</code>"
	  </para>

	  <para>
		As of PostGIS v1.4.0, all the functions have comments generated from the
		documentation. If you wish to install these comments into your spatial
		databases later, run the command which requires docbook.  The postgis_comments.sql and other
		package comments files raster_comments.sql, topology_comments.sql are
			also packaged in the tar.gz distribution in the doc folder so no need to make comments
			if installing from the tar ball.  Comments are also included as part of the CREATE EXTENSION install.
	  </para>

	  <para>
		<command>make comments</command>
	  </para>

	  <para>
		Introduced in PostGIS 2.0. This generates html cheat sheets suitable for quick reference or for student handouts.
		This requires xsltproc to build and will generate 4 files in doc folder <filename>topology_cheatsheet.html</filename>, <filename>tiger_geocoder_cheatsheet.html</filename>,
			<filename>raster_cheatsheet.html</filename>, <filename>postgis_cheatsheet.html</filename>
	  </para>
	  <para>You can download some pre-built ones available in html and pdf from <link xlink:href="http://www.postgis.us/study_guides">PostGIS / PostgreSQL Study Guides</link></para>

	  <para>
		<command>make cheatsheets</command>
	  </para>
	</section>

	<section xml:id="make_install_postgis_extensions">
	  <title>Building PostGIS Extensions and Deploying them</title>

	  <para>
		The PostGIS extensions are built and installed automatically if you are using PostgreSQL 9.1+.
	  </para>
	  <para>If you are building from source repository, you need to build the function descriptions first. These get built if you have docbook installed. You can also manually build with the statement:
    </para>
	  <para>
	  <command>make comments</command>
    </para>
	  <para>Building the comments is not necessary if you are building from a release tar ball since these are packaged pre-built with the tar ball already.</para>
	  <para>The extensions should automatically build as part of the make install process.  You can if needed build from the extensions
	  folders or copy files if you need them on a different server. </para>
	  <programlisting>cd extensions
cd postgis
make clean
make
export PGUSER=postgres #overwrite psql variables
make check #to test before install
make install
# to test extensions
make check RUNTESTFLAGS=--extension</programlisting>
		<note><para><code>make check</code> uses psql to run tests and as such can use psql environment variables.
		Common ones useful to override are <varname>PGUSER</varname>,<varname>PGPORT</varname>, and <varname>PGHOST</varname>. Refer to <link xlink:href="https://www.postgresql.org/docs/current/libpq-envars.html">psql environment variables</link> </para></note>
	  <para>The extension files will always be the same for the same version of PostGIS and PostgreSQL regardless of OS, so it is fine to copy over the extension files from one OS to another as long as you
	  have the PostGIS binaries already installed on your servers. </para>
		<para>If you want to install the extensions manually on a separate server different from your development,
		You need to copy the following files from the extensions folder into the <filename>PostgreSQL / share / extension</filename> folder
		of your PostgreSQL install as well as the needed binaries for regular PostGIS if you don't have them already on the server.
	  </para>

	  <itemizedlist>
		<listitem>
		  <para>
			These are the control files that denote information such as the version of the extension to install if not specified.
			<filename>postgis.control, postgis_topology.control</filename>.
		  </para>
		</listitem>
		<listitem>
		  <para>
			All the files in the /sql folder of each extension.  Note that these need to be copied to the root of the PostgreSQL share/extension folder
			<filename>extensions/postgis/sql/*.sql</filename>, <filename>extensions/postgis_topology/sql/*.sql</filename>
		  </para>
		</listitem>
	 </itemizedlist>
	 <para>Once you do that, you should see <varname>postgis</varname>, <varname>postgis_topology</varname> as available extensions in PgAdmin -&gt; extensions.</para>
	 <para>If you are using psql, you can verify that the extensions are installed by running this query:</para>
	 <programlisting>SELECT name, default_version,installed_version
FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%';

             name             | default_version | installed_version
------------------------------+-----------------+-------------------
 address_standardizer         | &last_release_version;         | &last_release_version;
 address_standardizer_data_us | &last_release_version;         | &last_release_version;
 postgis                      | &last_release_version;         | &last_release_version;
 postgis_raster               | &last_release_version;         | &last_release_version;
 postgis_sfcgal               | &last_release_version;         |
 postgis_tiger_geocoder       | &last_release_version;         | &last_release_version;
 postgis_topology             | &last_release_version;         |
(6 rows)</programlisting>

<para>If you have the extension installed in the database you are querying, you'll see mention in the <varname>installed_version</varname> column.
If you get no records back, it means you don't have postgis extensions installed on the server at all.  PgAdmin III 1.14+ will also provide this information
in the <varname>extensions</varname> section of the database browser tree and will even allow upgrade or uninstall by right-clicking.</para>

<para>If you have the extensions available, you can install postgis extension in your database of choice by either using pgAdmin extension interface or running these sql commands:</para>
<programlisting>CREATE EXTENSION postgis;
CREATE EXTENSION postgis_raster;
CREATE EXTENSION postgis_sfcgal;
CREATE EXTENSION fuzzystrmatch; --needed for postgis_tiger_geocoder
--optional used by postgis_tiger_geocoder, or can be used standalone
CREATE EXTENSION address_standardizer;
CREATE EXTENSION address_standardizer_data_us;
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION postgis_topology;</programlisting>

<para>In psql you can use to see what versions you have installed and also what schema they are installed. </para>
<programlisting>\connect mygisdb
\x
\dx postgis*</programlisting>

<screen>List of installed extensions
-[ RECORD 1 ]-------------------------------------------------
Name        | postgis
Version     | &last_release_version;
Schema      | public
Description | PostGIS geometry, geography, and raster spat..
-[ RECORD 2 ]-------------------------------------------------
Name        | postgis_raster
Version     | 3.0.0dev
Schema      | public
Description | PostGIS raster types and functions
-[ RECORD 3 ]-------------------------------------------------
Name        | postgis_tiger_geocoder
Version     | &last_release_version;
Schema      | tiger
Description | PostGIS tiger geocoder and reverse geocoder
-[ RECORD 4 ]-------------------------------------------------
Name        | postgis_topology
Version     | &last_release_version;
Schema      | topology
Description | PostGIS topology spatial types and functions</screen>

<warning><para>Extension tables <varname>spatial_ref_sys</varname>, <varname>layer</varname>, <varname>topology</varname> can not be explicitly backed up.  They can only
be backed up when the respective <varname>postgis</varname> or <varname>postgis_topology</varname> extension is backed up, which only seems to happen when you backup the whole database.
As of PostGIS 2.0.1, only srid records not packaged with PostGIS are backed up when the database is backed up so don't go around changing srids we package and expect your changes to be there. Put in a ticket if you find an issue.  The structures of extension tables are never backed up since they are created with <code>CREATE EXTENSION</code>
and assumed to be the same for a given version of an extension. These behaviors are built into the current PostgreSQL extension model, so nothing we can do about it.</para></warning>

<para>If you installed &last_release_version;, without using our
wonderful extension system, you can change it to be extension based by
running the below commands to package the functions in their respective extension.
Installing using `unpackaged` was removed in PostgreSQL 13, so you are advised to switch to an extension build before upgrading to PostgreSQL 13.
</para>
<programlisting>
CREATE EXTENSION postgis FROM unpackaged;
CREATE EXTENSION postgis_raster FROM unpackaged;
CREATE EXTENSION postgis_topology FROM unpackaged;
CREATE EXTENSION postgis_tiger_geocoder FROM unpackaged;
</programlisting>

	</section>


	<section>
	  <title>Testing</title>

	  <para>
		If you wish to test the PostGIS build, run
	  </para>

	  <para>
		<command>make check</command>
	  </para>

	  <para>
		The above command will run through various checks and regression tests
		using the generated library against an actual PostgreSQL database.
	  </para>

	  <note>
		<para>
		  If you configured PostGIS using non-standard PostgreSQL, GEOS, or
		  Proj locations, you may need to add their library locations to the
		  <varname>LD_LIBRARY_PATH</varname> environment variable.
		</para>
	  </note>

	  <caution>
		<para>
		  Currently, the <command>make check</command> relies on the
		  <code>PATH</code> and <code>PGPORT</code> environment variables when
		  performing the checks - it does <emphasis>not</emphasis> use the
		  PostgreSQL version that may have been specified using the
		  configuration parameter <command>--with-pgconfig</command>. So make
		  sure to modify your PATH to match the detected PostgreSQL installation
		  during configuration or be prepared to deal with the impending
		  headaches.
		</para>
	  </caution>

	  <para>
		If successful, make check will produce the output of almost 500 tests.  The results will look similar to the
		following (numerous lines omitted below):
	  </para>

	  <programlisting>

     CUnit - A unit testing framework for C - Version 2.1-3
     http://cunit.sourceforge.net/

	.
	.
	.

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites     44     44    n/a      0        0
               tests    300    300    300      0        0
             asserts   4215   4215   4215      0      n/a
Elapsed time =    0.229 seconds

	.
	.
	.

Running tests

	.
	.
	.

Run tests: 134
Failed: 0


-- if you build with SFCGAL

	.
	.
	.

Running tests

	.
	.
	.

Run tests: 13
Failed: 0

-- if you built with raster support

	.
	.
	.

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites     12     12    n/a      0        0
               tests     65     65     65      0        0
             asserts  45896  45896  45896      0      n/a


	.
	.
	.

Running tests

	.
	.
	.

Run tests: 101
Failed: 0

-- topology regress

.
.
.

Running tests

	.
	.
	.

Run tests: 51
Failed: 0

-- if you built --with-gui, you should see this too

     CUnit - A unit testing framework for C - Version 2.1-2
     http://cunit.sourceforge.net/

	.
	.
	.

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites      2      2    n/a      0        0
               tests      4      4      4      0        0
             asserts      4      4      4      0      n/a</programlisting>

	  <para>The <varname>postgis_tiger_geocoder</varname> and <varname>address_standardizer</varname> extensions, currently only support the standard PostgreSQL installcheck.  To test these use the below.  Note: the make install is not necessary if you already did make install at root of PostGIS code folder.</para>
	  <para>For address_standardizer:
	  <programlisting>cd extensions/address_standardizer
make install
make installcheck
	  </programlisting></para>

	  <para>Output should look like:
	  <screen>============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test test-init-extensions     ... ok
test test-parseaddress        ... ok
test test-standardize_address_1 ... ok
test test-standardize_address_2 ... ok

=====================
 All 4 tests passed.
=====================</screen></para>

	  <para>For tiger geocoder, make sure you have postgis and fuzzystrmatch extensions available in your PostgreSQL instance. The address_standardizer tests will also kick in if you built postgis with address_standardizer support:
	  <programlisting>cd extensions/postgis_tiger_geocoder
make install
make installcheck
	  </programlisting></para>
	  <para>output should look like:
	  <screen>============== dropping database "contrib_regression" ==============
DROP DATABASE
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== installing fuzzystrmatch               ==============
CREATE EXTENSION
============== installing postgis                     ==============
CREATE EXTENSION
============== installing postgis_tiger_geocoder      ==============
CREATE EXTENSION
============== installing address_standardizer        ==============
CREATE EXTENSION
============== running regression test queries        ==============
test test-normalize_address   ... ok
test test-pagc_normalize_address ... ok

=====================
All 2 tests passed.
=====================</screen></para>
	</section>

	<section>
	  <title>Installation</title>

	  <para>
		To install PostGIS, type
	  </para>

	  <para>
		<command>make install</command>
	  </para>

	  <para>
		This will copy the PostGIS installation files into their appropriate
		subdirectory specified by the <command>--prefix</command> configuration
		parameter. In particular:
	  </para>

	  <itemizedlist>
		<listitem>
		  <para>
			The loader and dumper binaries are installed in
			<filename>[prefix]/bin</filename>.
		  </para>
		</listitem>

		<listitem>
		  <para>
			The SQL files, such as <filename>postgis.sql</filename>, are
			installed in <filename>[prefix]/share/contrib</filename>.
		  </para>
		</listitem>

		<listitem>
		  <para>
			The PostGIS libraries are installed in
			<filename>[prefix]/lib</filename>.
		  </para>
		</listitem>
	  </itemizedlist>

	  <para>
		If you previously ran the <command>make comments</command> command to
		generate the <filename>postgis_comments.sql</filename>, <filename>raster_comments.sql</filename> file, install the
		sql file by running
	  </para>

	  <para>
		<command>make comments-install</command>
	  </para>

	  <note>
		<para>
		  <filename>postgis_comments.sql</filename>, <filename>raster_comments.sql</filename>, <filename>topology_comments.sql</filename> was separated from the
		  typical build and installation targets since with it comes the extra
		  dependency of <command>xsltproc</command>.
		</para>
	  </note>
	</section>
  </section>

  <section xml:id="installing_pagc_address_standardizer"><title>Installing and Using the address standardizer</title>
		<para>The <code>address_standardizer</code> extension used to be a separate package that required separate download. From PostGIS 2.2 on, it is now bundled in.
		For more information about the address_standardize, what it does, and how to configure it for your needs, refer to <xref linkend="Address_Standardizer"/>.</para>
		<para>This standardizer can be used in conjunction with the PostGIS packaged tiger geocoder extension as a replacement for the <xref linkend="Normalize_Address"/> discussed.
		To use as replacement refer to  <xref linkend="tiger_pagc_address_standardizing"/>.
		You can also use it as a building block for your own geocoder or use it to standardize your addresses for easier compare of addresses.</para>

		<para>The address standardizer relies on PCRE which is usually already installed on many Nix systems,
but you can download the latest at: <link xlink:href="http://www.pcre.org">http://www.pcre.org</link>. If during <xref linkend="installation_configuration"/>, PCRE is found, then the address standardizer extension will automatically be built.  If you have a custom pcre install you want to use instead, pass to configure <code>--with-pcredir=/path/to/pcre</code> where <filename>/path/to/pcre</filename> is the root folder for your pcre include and lib directories.</para>

		<para>For Windows users, the PostGIS 2.1+ bundle is packaged with the address_standardizer already so no need to compile and can move straight to <code>CREATE EXTENSION</code> step.</para>


      <para>Once you have installed, you can connect to your database and run the SQL:</para>
			<programlisting>CREATE EXTENSION address_standardizer;</programlisting>

			<para>The following test requires no rules, gaz, or lex tables</para>
			<programlisting>SELECT num, street, city, state, zip
 FROM parse_address('1 Devonshire Place PH301, Boston, MA 02109');</programlisting>
			<para>Output should be</para>
			<screen> num |         street         |  city  | state |  zip
-----+------------------------+--------+-------+-------
 1   | Devonshire Place PH301 | Boston | MA    | 02109</screen>

	</section>

  <section xml:id="loading_extras_tiger_geocoder">
	<title>Installing, Upgrading Tiger Geocoder, and loading data</title>

	<para>Extras like Tiger geocoder may not be packaged in your PostGIS distribution. If you are missing the tiger geocoder extension or want a newer version than what your install comes with, then use
	the <filename>share/extension/postgis_tiger_geocoder.*</filename> files from the packages in <link xlink:href="http://postgis.net/windows_downloads/">Windows Unreleased Versions</link> section for your version of PostgreSQL.
	Although these packages are for windows, the postgis_tiger_geocoder extension files will work on any OS since the extension is an SQL/plpgsql only extension.</para>
	<section xml:id="install_tiger_geocoder_extension">
		<title>Tiger Geocoder Enabling your PostGIS database</title>
		<orderedlist>
			<listitem><para>These directions assume your PostgreSQL installation already has the postgis_tiger_geocoder extension installed.</para></listitem>
			<listitem><para>Connect to your database via psql or pgAdmin or some other tool and run the following SQL commands.  Note that if you are installing in a database that already has postgis, you don't need to do the first step.  If you have <varname>fuzzystrmatch</varname> extension already installed, you don't need to do the second step either.</para>
			<para><programlisting>CREATE EXTENSION postgis;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
--this one is optional if you want to use the rules based standardizer (pagc_normalize_address)
CREATE EXTENSION address_standardizer;</programlisting></para>

<para>If you already have postgis_tiger_geocoder extension installed, and just want to update to the latest run:</para>
<programlisting>ALTER EXTENSION postgis UPDATE;
ALTER EXTENSION postgis_tiger_geocoder UPDATE;</programlisting>
<para>If you made custom entries or changes to <varname>tiger.loader_platform</varname> and <varname>tiger.loader_variables</varname> you may need to update these.</para>
</listitem>
			<listitem><para>To confirm your install is working correctly, run this sql in your database:</para>
				<programlisting>SELECT na.address, na.streetname,na.streettypeabbrev, na.zip
	FROM normalize_address('1 Devonshire Place, Boston, MA 02109') AS na;</programlisting>
				<para>Which should output</para>
				<para><screen> address | streetname | streettypeabbrev |  zip
---------+------------+------------------+-------
	   1 | Devonshire | Pl               | 02109</screen></para>
			</listitem>
			<listitem>
                <para>Create a new record in <varname>tiger.loader_platform</varname> table with the paths of your executables and server. </para>
				<para>So for example to create a profile called debbie that follows <code>sh</code> convention. You would do:</para>
				<programlisting>INSERT INTO tiger.loader_platform(os, declare_sect, pgbin, wget, unzip_command, psql, path_sep,
		   loader, environ_set_command, county_process_command)
SELECT 'debbie', declare_sect, pgbin, wget, unzip_command, psql, path_sep,
	   loader, environ_set_command, county_process_command
  FROM tiger.loader_platform
  WHERE os = 'sh';</programlisting>
				<para>And then edit the paths in the <emphasis>declare_sect</emphasis> column to those that fit Debbie's pg, unzip,shp2pgsql, psql, etc path locations.</para>

				<para>If you don't edit this  <varname>loader_platform</varname> table, it will just contain common case locations of items and you'll have to edit the generated script after the script is generated.</para>
			</listitem>
			<listitem><para>As of PostGIS 2.4.1 the Zip code-5 digit tabulation area <varname>zcta5</varname> load step was revised to load current zcta5 data and is part of the  <xref linkend="Loader_Generate_Nation_Script"/> when enabled.
It is turned off by default because it takes quite a bit of time to load (20 to 60 minutes), takes up quite a bit of disk space, and is not used that often.</para>
<para>To enable it, do the following:</para>
<programlisting>UPDATE tiger.loader_lookuptables SET load = true WHERE table_name = 'zcta520';</programlisting>
<para>
If present the <xref linkend="Geocode"/> function can use it if a boundary filter is added to limit to just zips in that boundary.
The <xref linkend="Reverse_Geocode"/> function uses it if the returned address is missing a zip, which often happens with highway reverse geocoding.</para></listitem>
			<listitem><para>Create a folder called <filename>gisdata</filename> on root of server or your local pc if you have a fast network connection to the server. This folder is
where the tiger files will be downloaded to and processed.  If you are not happy with having the folder on the root of the server, or simply want to change to a different folder for staging, then edit the field <varname>staging_fold</varname> in the <varname>tiger.loader_variables</varname> table.</para></listitem>
            <listitem><para>Create a folder called temp in the <filename>gisdata</filename> folder or wherever you designated the <varname>staging_fold</varname> to be.  This will be
the folder where the loader extracts the downloaded tiger data.</para></listitem>
			<listitem><para>Then run the  <xref linkend="Loader_Generate_Nation_Script"/>  SQL function make sure to use the name of your custom profile and copy the script to a .sh or .bat file.  So for example to build  the nation load:</para>
					<programlisting>psql -c "SELECT Loader_Generate_Nation_Script('debbie')" -d geocoder -tA &gt; /gisdata/nation_script_load.sh</programlisting>
			</listitem>

			<listitem><para>Run the generated nation load commandline scripts.</para>
				<programlisting>cd /gisdata
sh nation_script_load.sh</programlisting>
      </listitem>

      <listitem><para>After you are done running the nation script, you should have three tables in your <code>tiger_data</code> schema and they should be filled with data. Confirm you do by doing the following queries from psql or pgAdmin</para>
				<programlisting>SELECT count(*) FROM tiger_data.county_all;</programlisting>
<screen> count
-------
  3235
(1 row)</screen>
				<programlisting>SELECT count(*) FROM tiger_data.state_all;</programlisting>
<screen>
 count
-------
    56
(1 row)
</screen>
<para>This will only have data if you marked zcta5 to be loaded</para>
				<programlisting>SELECT count(*) FROM tiger_data.zcta5_all;</programlisting>
<screen>
 count
-------
  33933
(1 row)
</screen>
      </listitem>

			<listitem><para>By default the tables corresponding to <varname>bg</varname>, <varname>tract</varname>, <varname>tabblock20</varname> are not loaded. These tables are not used by the geocoder but are used by folks for population statistics.
			 If you wish to load them as part of your state loads, run the following statement to enable them.</para>
				<programlisting>UPDATE tiger.loader_lookuptables SET load = true WHERE load = false AND lookup_name IN('tract', 'bg', 'tabblock20');</programlisting>
				<para>Alternatively you can load just these tables after loading state data using the <xref linkend="Loader_Generate_Census_Script"/></para></listitem>

			<listitem><para>For each state you want to load data for, generate a state script <xref linkend="Loader_Generate_Script"/>.</para><warning><para>DO NOT Generate the state script until you have already loaded the nation data, because the state script utilizes county list loaded by nation script.</para></warning></listitem>

			<listitem><programlisting>psql -c "SELECT Loader_Generate_Script(ARRAY['MA'], 'debbie')" -d geocoder -tA &gt; /gisdata/ma_load.sh</programlisting></listitem>

			<listitem><para>Run the generated commandline scripts.</para>
				<programlisting>cd /gisdata
sh ma_load.sh</programlisting>
			</listitem>
			<listitem><para>After you are done loading all data or at a stopping point, it's a good idea to analyze all the tiger tables to update the stats (include inherited stats)</para>
			    <programlisting>SELECT install_missing_indexes();
vacuum (analyze, verbose) tiger.addr;
vacuum (analyze, verbose) tiger.edges;
vacuum (analyze, verbose) tiger.faces;
vacuum (analyze, verbose) tiger.featnames;
vacuum (analyze, verbose) tiger.place;
vacuum (analyze, verbose) tiger.cousub;
vacuum (analyze, verbose) tiger.county;
vacuum (analyze, verbose) tiger.state;
vacuum (analyze, verbose) tiger.zcta5;
vacuum (analyze, verbose) tiger.zip_lookup_base;
vacuum (analyze, verbose) tiger.zip_state;
vacuum (analyze, verbose) tiger.zip_state_loc;</programlisting>
			</listitem>
		</orderedlist>

	</section>
	<section xml:id="tiger_pagc_address_standardizing"><title>Using Address Standardizer Extension with Tiger geocoder</title>
			<para>One of the many complaints of folks is the address normalizer function <xref linkend="Normalize_Address"/> function that normalizes an address for prepping before geocoding.  The normalizer is far from perfect and trying to patch its imperfectness takes a vast amount of resources.  As such we have integrated with another
			project that has a much better address standardizer engine.  To use this new address_standardizer, you compile the extension as described in <xref linkend="installing_pagc_address_standardizer"/> and install as an extension in your database.</para>

			<para>Once you install this extension in the same database as you have installed <code>postgis_tiger_geocoder</code>, then the <xref linkend="Pagc_Normalize_Address"/> can be used instead of <xref linkend="Normalize_Address"/>. This extension is tiger agnostic, so can be used with other data sources such as international addresses. The tiger geocoder extension does come packaged with its own custom versions of <xref linkend="rulestab"/> ( <code>tiger.pagc_rules</code>) , <xref linkend="gaztab"/> (<code>tiger.pagc_gaz</code>), and <xref linkend="lextab"/> (<code>tiger.pagc_lex</code>).  These you can add and update to improve your standardizing experience for your own needs.</para>
	</section>
	<section xml:id="tiger_geocoder_required_tools">
		<title>Required tools for tiger data loading</title>
		<para>The load process downloads data from the census website for the respective nation files, states requested, extracts the files, and then loads each state into its own separate
		set of state tables.  Each state table inherits from the tables defined in <varname>tiger</varname> schema so that its sufficient to just query those tables to access all the data and drop a set of state tables at any time using the <xref linkend="Drop_State_Tables_Generate_Script"/> if you need to reload a state or just don't need a state anymore.</para>
		<para>In order to be able to load data you'll need the following tools:</para>
		<itemizedlist>
			<listitem><para>A tool to unzip the zip files from census website.</para>
			  <para>For Unix like systems: <varname>unzip</varname> executable which is usually already installed on most Unix like platforms.</para>
			  <para>For Windows, 7-zip which is a free compress/uncompress tool you can download from <link xlink:href="http://www.7-zip.org/">http://www.7-zip.org/</link> </para>
			</listitem>
			<listitem><para><filename>shp2pgsql</filename> commandline which is installed by default when you install PostGIS.</para></listitem>
			<listitem><para><filename>wget</filename> which is a web grabber tool usually installed on most Unix/Linux systems.</para>
				<para>If you are on windows, you can get pre-compiled binaries from <link xlink:href="http://gnuwin32.sourceforge.net/packages/wget.htm">http://gnuwin32.sourceforge.net/packages/wget.htm</link> </para>
			</listitem>
		</itemizedlist>
		<para>If you are upgrading from tiger_2010, you'll need to first generate and run <xref linkend="Drop_Nation_Tables_Generate_Script"/>. Before you load any state data, you need to load the nation wide data which you do with  <xref linkend="Loader_Generate_Nation_Script"/>. Which will
		generate a loader script for you.   <xref linkend="Loader_Generate_Nation_Script"/> is a one-time step that should be done for upgrading (from a prior year tiger census data) and for new installs.</para>
		<para>To load state data refer to <xref linkend="Loader_Generate_Script"/> to generate a data load script for your platform for the states you desire.
			Note that you can install these piecemeal. You don't have to load all the states you want all at once.  You can load them as you need them.</para>

		<para>After the states you desire have been loaded, make sure to run the:
		<programlisting>SELECT install_missing_indexes();</programlisting> as described in  <xref linkend="Install_Missing_Indexes"/>.</para>
		<para>To test that things are working as they should, try to run a geocode on an address in your state using <xref linkend="Geocode"/> </para>
	</section>
	<section xml:id="upgrade_tiger_geocoder">
		<title>Upgrading your Tiger Geocoder Install and Data</title>
        <para>First upgrade your postgis_tiger_geocoder extension as follows:</para>
        <programlisting>ALTER EXTENSION postgis_tiger_geocoder UPDATE;</programlisting>
		<para>Next drop all nation tables and load up the new ones. Generate a drop script with this SQL statement as detailed in <xref linkend="Drop_Nation_Tables_Generate_Script"/></para>
		<programlisting>SELECT drop_nation_tables_generate_script();</programlisting>
		<para>Run the generated drop SQL statements.</para>
		<para>Generate a nation load script with this SELECT statement as detailed in <xref linkend="Loader_Generate_Nation_Script"/></para>
		<para><emphasis role="bold">For windows</emphasis></para>
		<programlisting>SELECT loader_generate_nation_script('windows'); </programlisting>
		<para><emphasis role="bold">For unix/linux</emphasis></para>
		<programlisting>SELECT loader_generate_nation_script('sh');</programlisting>
		<para>Refer to <xref linkend="install_tiger_geocoder_extension"/> for instructions on how to run the generate script. This only needs to be done once.</para>
		<note><para>You can have a mix of different year state tables and can upgrade each state separately.  Before you upgrade a state you first need to drop the prior year state tables for that state using <xref linkend="Drop_State_Tables_Generate_Script"/>.</para></note>
	</section>

  </section>


  <section>
	<title>Common Problems during installation</title>
	<para>
	  There are several things to check when your installation or upgrade
	  doesn't go as you expected.
	</para>

	<orderedlist>
	  <listitem>
		<para>
		  Check that you have installed PostgreSQL &min_postgres_version;
		  or newer, and that you are compiling against the same version of the
		  PostgreSQL source as the version of PostgreSQL that is running.
		  Mix-ups can occur when your (Linux) distribution has already
		  installed PostgreSQL, or you have otherwise installed PostgreSQL
		  before and forgotten about it. PostGIS will only work with PostgreSQL
		  &min_postgres_version; or newer, and strange, unexpected
		  error messages will result if you use an older version. To check the
		  version of PostgreSQL which is running, connect to the database using
		  psql and run this query:
		</para>

		<programlisting>SELECT version();</programlisting>

		<para>
		  If you are running an RPM based distribution, you can check for the
		  existence of pre-installed packages using the <command>rpm</command>
		  command as follows: <command>rpm -qa | grep postgresql</command>
		</para>
	  </listitem>

	  <listitem>
		<para>If your upgrade fails, make sure you are restoring into a database that already has PostGIS installed.</para>
		<programlisting>SELECT postgis_full_version();</programlisting>
	  </listitem>
	</orderedlist>

	<para>
	  Also check that configure has correctly detected the location and version
	  of PostgreSQL, the Proj library and the GEOS library.
	</para>

	<orderedlist>
	  <listitem>
		<para>
		  The output from configure is used to generate the
		  <filename>postgis_config.h</filename> file. Check that the
		  <varname>POSTGIS_PGSQL_VERSION</varname>,
		  <varname>POSTGIS_PROJ_VERSION</varname> and
		  <varname>POSTGIS_GEOS_VERSION</varname> variables have been set
		  correctly.
		</para>
	  </listitem>
	</orderedlist>
  </section>

</chapter>