File: reference_coverage.xml

package info (click to toggle)
postgis 3.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 70,052 kB
  • sloc: ansic: 162,204; sql: 93,950; xml: 53,121; cpp: 12,646; perl: 5,658; sh: 5,369; makefile: 3,434; python: 1,205; yacc: 447; lex: 151; pascal: 58
file content (309 lines) | stat: -rw-r--r-- 12,074 bytes parent folder | download
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
<!-- Converted by db4-upgrade version 1.1 -->
<section xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Coverage">
  <title>Coverages</title><info>
    <abstract>
      <para>These functions operate on sets of polygonal geometry that form "implicit coverages".
      To form a valid coverage polygons must not overlap, and the vertices of adjacent edges must match exactly.
      Coverages are fast to process, and can be operated on with window functions, which retain the coverage topology inside the window partition while altering the edges.</para>
    </abstract>
  </info>



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

      <refpurpose>Window function that finds locations where polygons fail to form a valid coverage.</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
      <funcsynopsis>
        <funcprototype>
          <funcdef>geometry <function>ST_CoverageInvalidEdges</function></funcdef>
          <paramdef><type>geometry winset </type>
            <parameter>geom</parameter></paramdef>
          <paramdef><type>float8 </type>
            <parameter>tolerance = 0</parameter></paramdef>
        </funcprototype>
      </funcsynopsis>
    </refsynopsisdiv>

    <refsection>
      <title>Description</title>

      <para>A window function which checks if the polygons in the window partition form a valid polygonal coverage.
      It returns linear indicators showing the location of invalid edges (if any) in each polygon.
      </para>
      <para>A set of valid polygons is a valid coverage if the following conditions hold:
        </para>

      <itemizedlist>
        <listitem><para>
            <emphasis role="bold">Non-overlapping</emphasis> - polygons do not overlap (their interiors do not intersect)
            </para></listitem>
        <listitem><para>
            <emphasis role="bold">Edge-Matched</emphasis> - vertices along shared edges are identical
            </para></listitem>
      </itemizedlist>

      <para>As a window function a value is returned for every input polygon.
      For polygons which violate one or more of the validity conditions the return value is a MULTILINESTRING containing the problematic edges.
      Coverage-valid polygons return the value NULL.
      Non-polygonal or empty geometries also produce NULL values.</para>

      <para>The conditions allow a valid coverage to contain holes (gaps between polygons),
      as long as the surrounding polygons are edge-matched.
      However, very narrow gaps are often undesirable.
      If the <parameter>tolerance</parameter> parameter is specified with a non-zero distance,
      edges forming narrower gaps will also be returned as invalid.
      </para>

      <para>The polygons being checked for coverage validity must also be valid geometries.
      This can be checked with <xref linkend="ST_IsValid"/>.
      </para>

      <para role="availability" conformance="3.4.0">Availability: 3.4.0</para>
      <para role="geos_requirement" conformance="3.12.0">Requires GEOS &gt;= 3.12.0</para>
    </refsection>

    <refsection>
      <title>Examples</title>

        <informalfigure>
          <mediaobject>
              <imageobject>
              <imagedata fileref="images/st_coverageinvalidedges01.png"/>
              </imageobject>
              <caption><para>Invalid edges caused by overlap and non-matching vertices</para></caption>
          </mediaobject>
        </informalfigure>

      <programlisting>WITH coverage(id, geom) AS (VALUES
  (1, 'POLYGON ((10 190, 30 160, 40 110, 100 70, 120 10, 10 10, 10 190))'::geometry),
  (2, 'POLYGON ((100 190, 10 190, 30 160, 40 110, 50 80, 74 110.5, 100 130, 140 120, 140 160, 100 190))'::geometry),
  (3, 'POLYGON ((140 190, 190 190, 190 80, 140 80, 140 190))'::geometry),
  (4, 'POLYGON ((180 40, 120 10, 100 70, 140 80, 190 80, 180 40))'::geometry)
)
SELECT id, ST_AsText(ST_CoverageInvalidEdges(geom) OVER ())
  FROM coverage;

 id |               st_astext
----+---------------------------------------
  1 | LINESTRING (40 110, 100 70)
  2 | MULTILINESTRING ((100 130, 140 120, 140 160, 100 190), (40 110, 50 80, 74 110.5))
  3 | LINESTRING (140 80, 140 190)
  4 | null
      </programlisting>

      <programlisting>-- Test entire table for coverage validity
SELECT true = ALL (
    SELECT ST_CoverageInvalidEdges(geom) OVER () IS NULL
    FROM coverage
    );
      </programlisting>
    </refsection>

    <refsection>
      <title>See Also</title>
      <para>
        <xref linkend="ST_IsValid"/>,
        <xref linkend="ST_CoverageUnion"/>,
        <xref linkend="ST_CoverageSimplify"/>
      </para>
    </refsection>

  </refentry>


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

      <refpurpose>Window function that simplifies the edges of a polygonal coverage.</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
      <funcsynopsis>
        <funcprototype>
          <funcdef>geometry <function>ST_CoverageSimplify</function></funcdef>
          <paramdef><type>geometry winset </type>
            <parameter>geom</parameter></paramdef>
          <paramdef><type>float8 </type>
            <parameter>tolerance</parameter></paramdef>
          <paramdef choice="opt"><type>boolean </type>
            <parameter>simplifyBoundary = true</parameter></paramdef>
        </funcprototype>
      </funcsynopsis>
    </refsynopsisdiv>

    <refsection>
      <title>Description</title>

      <para>A window function which simplifies the edges of polygons in a polygonal coverage.
      The simplification preserves the coverage topology.
      This means the simplified output polygons are consistent along shared edges, and still form a valid coverage.
      </para>

      <para>The simplification uses a variant of the <link xlink:href="https://en.wikipedia.org/wiki/Visvalingam%E2%80%93Whyatt_algorithm">Visvalingam–Whyatt algorithm</link>.
      The <parameter>tolerance</parameter> parameter has units of distance,
      and is roughly equal to the square root of triangular areas to be simplified.
      </para>

      <para>To simplify only the "internal" edges of the coverage (those that are shared by two polygons) set the <parameter>simplifyBoundary</parameter> parameter to false.</para>

      <note><para>If the input is not a valid coverage there may be unexpected artifacts in the output (such as boundary intersections, or separated boundaries which appeared to be shared).
      Use <xref linkend="ST_CoverageInvalidEdges"/> to determine if a coverage is valid.
      </para></note>

      <para role="availability" conformance="3.4.0">Availability: 3.4.0</para>
      <para role="geos_requirement" conformance="3.12.0">Requires GEOS &gt;= 3.12.0</para>
    </refsection>

    <refsection>
      <title>Examples</title>
    <informaltable>
      <tgroup cols="2">
      <tbody>
        <row>
        <entry><para>
        <informalfigure>
          <mediaobject>
              <imageobject>
              <imagedata fileref="images/st_coveragesimplify01.png"/>
              </imageobject>
              <caption><para>Input coverage</para></caption>
          </mediaobject>
        </informalfigure>
        </para></entry>
        <entry><para>
        <informalfigure>
          <mediaobject>
              <imageobject>
              <imagedata fileref="images/st_coveragesimplify02.png"/>
              </imageobject>
              <caption><para>Simplified coverage</para></caption>
          </mediaobject>
        </informalfigure>
        </para></entry>
       </row>
      </tbody>
      </tgroup>
    </informaltable>

      <programlisting>WITH coverage(id, geom) AS (VALUES
  (1, 'POLYGON ((160 150, 110 130, 90 100, 90 70, 60 60, 50 10, 30 30, 40 50, 25 40, 10 60, 30 100, 30 120, 20 170, 60 180, 90 190, 130 180, 130 160, 160 150), (40 160, 50 140, 66 125, 60 100, 80 140, 90 170, 60 160, 40 160))'::geometry),
  (2, 'POLYGON ((40 160, 60 160, 90 170, 80 140, 60 100, 66 125, 50 140, 40 160))'::geometry),
  (3, 'POLYGON ((110 130, 160 50, 140 50, 120 33, 90 30, 50 10, 60 60, 90 70, 90 100, 110 130))'::geometry),
  (4, 'POLYGON ((160 150, 150 120, 160 90, 160 50, 110 130, 160 150))'::geometry)
)
SELECT id, ST_AsText(ST_CoverageSimplify(geom, 30) OVER ())
  FROM coverage;

 id |               st_astext
----+---------------------------------------
  1 | POLYGON ((160 150, 110 130, 50 10, 10 60, 20 170, 90 190, 160 150), (40 160, 66 125, 90 170, 40 160))
  2 | POLYGON ((40 160, 66 125, 90 170, 40 160))
  3 | POLYGON ((110 130, 160 50, 50 10, 110 130))
  4 | POLYGON ((160 150, 160 50, 110 130, 160 150))
      </programlisting>
    </refsection>

    <refsection>
      <title>See Also</title>
      <para>
        <xref linkend="ST_CoverageInvalidEdges"/>
      </para>
    </refsection>

  </refentry>

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

      <refpurpose>Computes the union of a set of polygons forming a coverage by removing shared edges.</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
      <funcsynopsis>
        <funcprototype>
          <funcdef>geometry <function>ST_CoverageUnion</function></funcdef>
          <paramdef><type>geometry set</type>
            <parameter>geom</parameter></paramdef>
        </funcprototype>
      </funcsynopsis>
    </refsynopsisdiv>

    <refsection>
      <title>Description</title>

      <para>An aggregate function which unions a set of polygons forming a polygonal coverage.
      The result is a polygonal geometry covering the same area as the coverage.
      This function produces the same result as <xref linkend="ST_Union"/>,
      but uses the coverage structure to compute the union much faster.
      </para>

      <note><para>If the input is not a valid coverage there may be unexpected artifacts in the output (such as unmerged or overlapping polygons).
            Use <xref linkend="ST_CoverageInvalidEdges"/> to determine if a coverage is valid.
      </para></note>

      <para role="availability" conformance="3.4.0">Availability: 3.4.0 - requires GEOS &gt;= 3.8.0</para>
    </refsection>

    <refsection>
      <title>Examples</title>
    <informaltable>
      <tgroup cols="2">
      <tbody>
        <row>
        <entry><para>
        <informalfigure>
          <mediaobject>
              <imageobject>
              <imagedata fileref="images/st_coverageunion01.png"/>
              </imageobject>
              <caption><para>Input coverage</para></caption>
          </mediaobject>
        </informalfigure>
        </para></entry>
        <entry><para>
        <informalfigure>
          <mediaobject>
              <imageobject>
              <imagedata fileref="images/st_coverageunion02.png"/>
              </imageobject>
              <caption><para>Union result</para></caption>
          </mediaobject>
        </informalfigure>
        </para></entry>
       </row>
      </tbody>
      </tgroup>
    </informaltable>

      <programlisting>WITH coverage(id, geom) AS (VALUES
  (1, 'POLYGON ((10 10, 10 150, 80 190, 110 150, 90 110, 40 110, 50 60, 10 10))'::geometry),
  (2, 'POLYGON ((120 10, 10 10, 50 60, 100 70, 120 10))'::geometry),
  (3, 'POLYGON ((140 80, 120 10, 100 70, 40 110, 90 110, 110 150, 140 80))'::geometry),
  (4, 'POLYGON ((140 190, 120 170, 140 130, 160 150, 140 190))'::geometry),
  (5, 'POLYGON ((180 160, 170 140, 140 130, 160 150, 140 190, 180 160))'::geometry)
)
SELECT ST_AsText(ST_CoverageUnion(geom))
  FROM coverage;

--------------------------------------
MULTIPOLYGON (((10 150, 80 190, 110 150, 140 80, 120 10, 10 10, 10 150), (50 60, 100 70, 40 110, 50 60)), ((120 170, 140 190, 180 160, 170 140, 140 130, 120 170)))
      </programlisting>
    </refsection>

    <refsection>
      <title>See Also</title>
      <para>
        <xref linkend="ST_CoverageInvalidEdges"/>,
        <xref linkend="ST_Union"/>
      </para>
    </refsection>

  </refentry>
</section>