File: reference_troubleshooting.xml

package info (click to toggle)
postgis 3.5.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 69,528 kB
  • sloc: ansic: 162,229; sql: 93,970; 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 (162 lines) | stat: -rw-r--r-- 5,317 bytes parent folder | download | duplicates (4)
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
<!-- Converted by db4-upgrade version 1.1 -->
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Troubleshooting_Functions">
    <title>Troubleshooting Functions</title><info>
    <abstract>
	<para>These functions are utilities for troubleshooting and repairing geometry data.
	They are only needed if the geometry data is corrupted in some way,
	which should never happen under normal circumstances.</para>
   </abstract>
    </info>
	

	<refentry xml:id="PostGIS_AddBBox">
		  <refnamediv>
			<refname>PostGIS_AddBBox</refname>

			<refpurpose>Add bounding box to the geometry.</refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>geometry <function>PostGIS_AddBBox</function></funcdef>
				<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>Add bounding box to the geometry. This would make bounding
			box based queries faster, but will increase the size of the
			geometry.</para>

			<note>
			  <para>Bounding boxes are automatically added to geometries so in general this is not needed
				unless the generated bounding box somehow becomes corrupted or you have an old install that is lacking bounding boxes.  Then you need to drop the old and re-add.</para>
			</note>

			<para>&curve_support;</para>
		  </refsection>


		  <refsection>
			<title>Examples</title>

			<programlisting>UPDATE sometable
 SET geom =  PostGIS_AddBBox(geom)
 WHERE PostGIS_HasBBox(geom) = false;</programlisting>
		  </refsection>

		  <!-- Optionally add a "See Also" section -->
		  <refsection>
			<title>See Also</title>

			<para><xref linkend="PostGIS_DropBBox"/>, <xref linkend="PostGIS_HasBBox"/></para>
		  </refsection>
	</refentry>

	<refentry xml:id="PostGIS_DropBBox">
		  <refnamediv>
			<refname>PostGIS_DropBBox</refname>

			<refpurpose>Drop the bounding box cache from the geometry.</refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>geometry <function>PostGIS_DropBBox</function></funcdef>
				<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>Drop the bounding box cache from the geometry. This reduces
			geometry size, but makes bounding-box based queries slower.  It is also used to drop a corrupt bounding box.  A tale-tell sign of a corrupt cached bounding box
				is when your ST_Intersects and other relation queries leave out geometries that rightfully should return true.</para>

			<note>
			  <para>Bounding boxes are automatically added to geometries and improve speed of queries so in general this is not needed
				unless the generated bounding box somehow becomes corrupted or you have an old install that is lacking bounding boxes.
				Then you need to drop the old and re-add.  This kind of corruption has been observed in 8.3-8.3.6 series whereby cached bboxes were not always recalculated when a geometry changed and upgrading to a newer version without a dump reload will not
				correct already corrupted boxes.  So one can manually correct using below and re-add the bbox or do a dump reload.</para>
			</note>

			<para>&curve_support;</para>
		  </refsection>


		  <refsection>
			<title>Examples</title>

			<programlisting>--This example drops bounding boxes where the cached box is not correct
			--The force to ST_AsBinary before applying Box2D forces a recalculation of the box, and Box2D applied to the table geometry always
			-- returns the cached bounding box.
			UPDATE sometable
 SET geom =  PostGIS_DropBBox(geom)
 WHERE Not (Box2D(ST_AsBinary(geom)) = Box2D(geom));

	UPDATE sometable
 SET geom =  PostGIS_AddBBox(geom)
 WHERE Not PostGIS_HasBBOX(geom);


 </programlisting>
		  </refsection>

		  <!-- Optionally add a "See Also" section -->
		  <refsection>
			<title>See Also</title>

			<para><xref linkend="PostGIS_AddBBox"/>, <xref linkend="PostGIS_HasBBox"/>, <xref linkend="Box2D"/></para>
		  </refsection>
	</refentry>


	<refentry xml:id="PostGIS_HasBBox">
	  <refnamediv>
		<refname>PostGIS_HasBBox</refname>

		<refpurpose>Returns TRUE if the bbox of this geometry is cached, FALSE otherwise.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>PostGIS_HasBBox</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns TRUE if the bbox of this geometry is cached, FALSE
				otherwise. Use <xref linkend="PostGIS_AddBBox"/> and <xref linkend="PostGIS_DropBBox"/> to control caching.</para>

		<para>&curve_support;</para>
	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT geom
FROM sometable WHERE PostGIS_HasBBox(geom) = false;</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="PostGIS_AddBBox"/>, <xref linkend="PostGIS_DropBBox"/></para>
	  </refsection>
	</refentry>

 </section>