[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha3-37-g8409c6b

git at osgeo.org git at osgeo.org
Mon Dec 7 16:40:56 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  8409c6b71527a0b692ea3ccb479719c5a9bb858c (commit)
      from  76a849ed6ca739d3abfbef8001fda23d4b652e90 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8409c6b71527a0b692ea3ccb479719c5a9bb858c
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Mon Dec 7 16:40:50 2020 -0800

    Improve doc for DE-9IM and relate

diff --git a/doc/reference_relationship.xml b/doc/reference_relationship.xml
index c75bc0d..fff8479 100644
--- a/doc/reference_relationship.xml
+++ b/doc/reference_relationship.xml
@@ -1369,7 +1369,7 @@ FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 0.5)'), 3)  As a,
 				<funcdef>text <function>ST_Relate</function></funcdef>
 				<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
 				<paramdef><type>geometry </type> <parameter>geomB</parameter></paramdef>
-				<paramdef><type>integer </type> <parameter>BoundaryNodeRule</parameter></paramdef>
+				<paramdef><type>integer </type> <parameter>boundaryNodeRule</parameter></paramdef>
 			  </funcprototype>
 			</funcsynopsis>
 		</refsynopsisdiv>
@@ -1377,80 +1377,134 @@ FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 0.5)'), 3)  As a,
 		<refsection>
 			<title>Description</title>
 
-			<para>Variant 1: Tests if two geometries are spatially related
-                according to the given <varname>intersectionMatrixPattern</varname>, by testing for intersections between the
-					Interior, Boundary and Exterior of the two geometries as specified
-					by the values in the <ulink url="http://en.wikipedia.org/wiki/DE-9IM">DE-9IM matrix pattern</ulink>.</para>
-
-			<para>This is useful for testing multiple conditions of intersection, crosses, etc in one step.
-            It also allows testing spatial relationships which do not have a named pattern
-            (for example, "interior-intersects" which has the pattern <code>T********</code>).
+            <para>
+            These functions allow testing and evaluating the spatial (topological) relationship between two geometries,
+            as defined by the <ulink url="http://en.wikipedia.org/wiki/DE-9IM">Dimensionally Extended 9-Intersection Model</ulink> (DE-9IM).
+            </para>
+            <para>
+            The DE-9IM is specified as a 9-element matrix indicating the dimension of the intersections between the
+            Interior, Boundary and Exterior of two geometries.
+            It is represented by a 9-character text string using the symbols 'F', '0', '1', '2'
+            (e.g. <code>'FF1FF0102'</code>).
+            </para>
+            <para>
+            A specific kind of spatial relationships is evaluated by comparing the intersection
+            matrix to an <emphasis>intersection matrix pattern</emphasis>.
+            A pattern can include the additional symbols 'T' and '*'.
+            Common spatial relationships are provided by the named functions
+            <xref linkend="ST_Contains" />, <xref linkend="ST_ContainsProperly" />,
+            <xref linkend="ST_Covers" />, <xref linkend="ST_CoveredBy" />,
+            <xref linkend="ST_Crosses" />, <xref linkend="ST_Disjoint" />, <xref linkend="ST_Equals" />,
+            <xref linkend="ST_Intersects" />, <xref linkend="ST_Overlaps" />, <xref linkend="ST_Touches" />,
+            and <xref linkend="ST_Within" />.
+            Using an explicit pattern allows testing multiple conditions of intersects, crosses, etc in one step.
+            It also allows testing spatial relationships which do not have a named spatial relationship function.
+            For example, the relationship "Interior-Intersects" has the DE-9IM pattern <code>T********</code>,
+            which is not evaluated by any named predicate.
+            </para>
+            <para>
+             For more information refer to <xref linkend="DE-9IM" />.
             </para>
 
-			<note><para>This is the "allowable" version that returns a
-			boolean, not an integer.  This is defined in OGC spec</para></note>
+			<para><emphasis role="bold">Variant 1:</emphasis> Tests if two geometries are spatially related
+            according to the given <varname>intersectionMatrixPattern</varname>.
+            </para>
 
-			<note><para>This does NOT automatically include an index call.
+			<note><para>Unlike most of the named spatial relationship predicates,
+                this does NOT automatically include an index call.
                 The reason is that some relationships are true for geometries
-                whose extents do NOT intersect (e.g. Disjoint).  If you are
+                which do NOT intersect (e.g. Disjoint).  If you are
 				using a relationship pattern that requires intersection, then include the &&
-				index call.</para></note>
-
-			<para>Variant 2: Returns the <xref linkend="DE-9IM" /> matrix string for the
-                relationship between the two inputs</para>
-
-			<para>Variant 3: same as variant 2, but allows specifying a boundary node rule (1:OGC/MOD2, 2:Endpoint, 3:MultivalentEndpoint, 4:MonovalentEndpoint)</para>
+				index call.
+                </para></note>
+
+			<note><para>It is better to use a named relationship function if available,
+            since they automatically use a spatial index where one exists.
+            Also, they may implement performance optimizations which are not available
+            with full relate evalation.
+                </para></note>
+
+			<para><emphasis role="bold">Variant 2:</emphasis> Returns the DE-9IM matrix string for the
+            spatial relationship between the two input geometries.
+            The matrix string can be tested for matching a DE-9IM pattern using <xref linkend="ST_RelateMatch" />.
+            </para>
 
-			<important>
-			  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para>
-			</important>
+			<para><emphasis role="bold">Variant 3:</emphasis> Like variant 2,
+            but allows specifying a <emphasis role="bold">Boundary Node Rule</emphasis>.
+            A boundary node rule allows finer control over whether geometry boundary points are
+            considered to lie in the DE-9IM Interior or Boundary.
+            The <varname>boundaryNodeRule</varname> code is:
+            1: OGC/MOD2, 2: Endpoint, 3: MultivalentEndpoint, 4: MonovalentEndpoint. </para>
 
-			<para>not in OGC spec, but implied. see s2.1.13.2</para>
+			<para>This function is not in the OGC spec, but is implied. see s2.1.13.2</para>
 			<para>&sfs_compliant; s2.1.1.2 // s2.1.13.3</para>
 			<para>&sqlmm_compliant; SQL-MM 3: 5.1.25</para>
 			<para>Performed by the GEOS module</para>
 			<para>Enhanced: 2.0.0 - added support for specifying boundary node rule.</para>
+			<important>
+			  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para>
+			</important>
+
 		</refsection>
 
 
 		<refsection>
 		<title>Examples</title>
+
+        <para>Using the boolean-valued function to test spatial relationships.</para>
 		<programlisting>
---Find all compounds that intersect and not touch a poly (interior intersects)
-SELECT l.* , b.name As poly_name
-	FROM polys As b
-INNER JOIN compounds As l
-ON (p.the_geom && b.the_geom
-AND ST_Relate(l.the_geom, b.the_geom,'T********'));
-
-SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2));
+SELECT ST_Relate('POINT(1 2)', ST_Buffer( 'POINT(1 2)', 2), '0FFFFF212');
 st_relate
 -----------
-0FFFFF212
+t
 
-SELECT ST_Relate(ST_GeometryFromText('LINESTRING(1 2, 3 4)'), ST_GeometryFromText('LINESTRING(5 6, 7 8)'));
+SELECT ST_Relate(POINT(1 2)', ST_Buffer( 'POINT(1 2)', 2), '*FF*FF212');
 st_relate
 -----------
-FF1FF0102
+t
+</programlisting>
 
+        <para>Testing a custom spatial relationship pattern as a query condition,
+        with <code>&&</code> to enable using a spatial index.</para>
+		<programlisting>
+-- Find compounds that properly intersect (not just touch) a poly (Interior Intersects)
 
-SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2), '0FFFFF212');
+SELECT c.* , p.name As poly_name
+    FROM polys AS p
+    INNER JOIN compounds As c
+          ON c.geom && p.geom
+             AND ST_Relate(p.geom, c.geom,'T********');
+</programlisting>
+
+         <para>Computing the intersection matrix for spatial relationships.</para>
+		<programlisting>
+SELECT ST_Relate( 'POINT(1 2)',
+                  ST_Buffer( 'POINT(1 2)', 2));
 st_relate
 -----------
-t
+0FFFFF212
 
-SELECT ST_Relate(ST_GeometryFromText('POINT(1 2)'), ST_Buffer(ST_GeometryFromText('POINT(1 2)'),2), '*FF*FF212');
+SELECT ST_Relate( 'LINESTRING(1 2, 3 4)',
+                  'LINESTRING(5 6, 7 8)' );
 st_relate
 -----------
-t
-		</programlisting>
+FF1FF0102
+</programlisting>
+
 	</refsection>
 
 	<!-- Optionally add a "See Also" section -->
 	<refsection>
 		<title>See Also</title>
 
-		<para><xref linkend="ST_Crosses" />, <xref linkend="DE-9IM" />, <xref linkend="ST_Disjoint" />, <xref linkend="ST_Intersects" />, <xref linkend="ST_Touches" /></para>
+		<para>
+            <xref linkend="DE-9IM" />, <xref linkend="ST_RelateMatch" />,
+            <xref linkend="ST_Contains" />, <xref linkend="ST_ContainsProperly" />,
+            <xref linkend="ST_Covers" />, <xref linkend="ST_CoveredBy" />,
+            <xref linkend="ST_Crosses" />, <xref linkend="ST_Disjoint" />, <xref linkend="ST_Equals" />,
+            <xref linkend="ST_Intersects" />, <xref linkend="ST_Overlaps" />,
+            <xref linkend="ST_Touches" />, <xref linkend="ST_Within" />
+        </para>
 	</refsection>
 </refentry>
 
@@ -1458,7 +1512,8 @@ t
 	<refnamediv>
 		<refname>ST_RelateMatch</refname>
 
-		<refpurpose>Returns true if an Intersection Matrix value matches an Intersection Matrix pattern</refpurpose>
+		<refpurpose>Returns true if a DE-9IM Intersection Matrix value matches an Intersection Matrix pattern
+        </refpurpose>
 	</refnamediv>
 
 	<refsynopsisdiv>
@@ -1474,10 +1529,17 @@ t
 	<refsection>
 		<title>Description</title>
 
-		<para> Tests if an <varname>intersectionMatrix</varname> value satisfies
+		<para>
+        Tests if a <ulink url="http://en.wikipedia.org/wiki/DE-9IM">Dimensionally Extended 9-Intersection Model</ulink> (DE-9IM)
+        <varname>intersectionMatrix</varname> value satisfies
 		an <varname>intersectionMatrixPattern</varname>.
-        For more information refer to <xref linkend="DE-9IM" />.	</para>
+        Intersection matrix values can be computed by <xref linkend="ST_Relate" />.
+        </para>
+        <para>
+        For more information refer to <xref linkend="DE-9IM" />.
+        </para>
 		<para>Performed by the GEOS module</para>
+
 		<para>Availability: 2.0.0</para>
 	</refsection>
 
@@ -1488,21 +1550,38 @@ t
 SELECT ST_RelateMatch('101202FFF', 'TTTTTTFFF') ;
 -- result --
 t
---example of common intersection matrix patterns and example matrices
--- comparing relationships of involving one invalid geometry and ( a line and polygon that intersect at interior and boundary)
-SELECT mat.name, pat.name, ST_RelateMatch(mat.val, pat.val) As satisfied
-    FROM
-        ( VALUES ('Equality', 'T1FF1FFF1'),
-                ('Overlaps', 'T*T***T**'),
-                ('Within', 'T*F**F***'),
-                ('Disjoint', 'FF*FF****') As pat(name,val)
-        CROSS JOIN
-            (	VALUES ('Self intersections (invalid)', '111111111'),
-                    ('IE2_BI1_BB0_BE1_EI1_EE2', 'FF2101102'),
-                    ('IB1_IE1_BB0_BE0_EI2_EI1_EE2', 'F11F00212')
-            ) As mat(name,val);
-
-		</programlisting>
+</programlisting>
+		<para>Patterns for common spatial relationships
+matched against intersection matrix values,
+for a line in various positions relative to a polygon</para>
+		<programlisting>
+SELECT pat.name AS relationship, pat.val AS pattern,
+       mat.name AS position, mat.val AS matrix,
+       ST_RelateMatch(mat.val, pat.val) AS match
+    FROM (VALUES ( 'Equality', 'T1FF1FFF1' ),
+                 ( 'Overlaps', 'T*T***T**' ),
+                 ( 'Within',   'T*F**F***' ),
+                 ( 'Disjoint', 'FF*FF****' )) AS pat(name,val)
+    CROSS JOIN
+        (VALUES  ('non-intersecting', 'FF1FF0212'),
+                 ('overlapping',      '1010F0212'),
+                 ('inside',           '1FF0FF212')) AS mat(name,val);
+
+ relationship |  pattern  |     position     |  matrix   | match
+--------------+-----------+------------------+-----------+-------
+ Equality     | T1FF1FFF1 | non-intersecting | FF1FF0212 | f
+ Equality     | T1FF1FFF1 | overlapping      | 1010F0212 | f
+ Equality     | T1FF1FFF1 | inside           | 1FF0FF212 | f
+ Overlaps     | T*T***T** | non-intersecting | FF1FF0212 | f
+ Overlaps     | T*T***T** | overlapping      | 1010F0212 | t
+ Overlaps     | T*T***T** | inside           | 1FF0FF212 | f
+ Within       | T*F**F*** | non-intersecting | FF1FF0212 | f
+ Within       | T*F**F*** | overlapping      | 1010F0212 | f
+ Within       | T*F**F*** | inside           | 1FF0FF212 | t
+ Disjoint     | FF*FF**** | non-intersecting | FF1FF0212 | t
+ Disjoint     | FF*FF**** | overlapping      | 1010F0212 | f
+ Disjoint     | FF*FF**** | inside           | 1FF0FF212 | f
+</programlisting>
 	</refsection>
 
 	<!-- Optionally add a "See Also" section -->
diff --git a/doc/using_postgis_dataman.xml b/doc/using_postgis_dataman.xml
index 07ad721..de78a9d 100644
--- a/doc/using_postgis_dataman.xml
+++ b/doc/using_postgis_dataman.xml
@@ -6,9 +6,9 @@
 	<title>GIS Objects</title>
 
 	<para>The GIS objects supported by PostGIS are a superset of the "Simple
-	Features" defined by the OpenGIS Consortium (OGC).
+	Features" standard defined by the OpenGIS Consortium (OGC).
 	PostGIS supports all the objects and functions specified in the OGC
-	"Simple Features for SQL" specification.</para>
+	"Simple Features for SQL" specification (SFS).</para>
 
 	<para>PostGIS extends the standard with support for embedded SRID information.</para>
 
@@ -1211,13 +1211,24 @@ gisdb=# SELECT
 	</sect3>
 
       <sect3 id="DE-9IM">
-        <title>Dimensionally Extended 9 Intersection Model (DE-9IM)</title>
+        <title>Evaluating Spatial Relationships with the DE-9IM</title>
 
-        <para>It is sometimes the case that the typical spatial predicates
-        (<xref linkend="ST_Intersects" />, <xref linkend="ST_Contains" />,
-				<xref linkend="ST_Crosses" />, <xref linkend="ST_Touches" />, ...) are
-        insufficient in and of themselves to adequately provide that desired
-        spatial filter.</para>
+        <para>
+        The OGC SFS defines a set of <emphasis>named spatial relationship predicates</emphasis> to evaluate the
+        spatial relationship between pairs of geometries.
+        PostGIS provides these as the functions
+            <xref linkend="ST_Contains" />,
+            <xref linkend="ST_Crosses" />, <xref linkend="ST_Disjoint" />, <xref linkend="ST_Equals" />,
+            <xref linkend="ST_Intersects" />, <xref linkend="ST_Overlaps" />,
+            <xref linkend="ST_Touches" />, <xref linkend="ST_Within" />.
+        It also defines the non-standard relationship predicates
+            <xref linkend="ST_Covers" />, <xref linkend="ST_CoveredBy" />,
+            and <xref linkend="ST_ContainsProperly" />.
+        </para>
+
+        <para>In some cases the named spatial relationships
+        are insufficient to  provide a desired spatial filter.
+        </para>
 
         <informaltable frame="none" border="0">
           <tgroup cols="1">
@@ -1226,23 +1237,23 @@ gisdb=# SELECT
                 <entry><para><informalfigure float="1" floatstyle="left">
                     <graphic align="left" fileref="images/de9im01.png" />
                   </informalfigure></para><para>For example, consider a linear
-                dataset representing a road network. It may be the task of a
-                GIS analyst to identify all road segments that cross
-                each other, not at a point, but on a line, perhaps invalidating
-                some business rule. In this case, <xref linkend="ST_Crosses" /> does not
-                adequately provide the necessary spatial filter since, for
-                linear features, it returns <varname>true</varname> only where
-                they cross at a point.</para> <para>One two-step solution
-                might be to first perform the actual intersection
-                (<xref linkend="ST_Intersection" />) of pairs of road segments that spatially
-                intersect (<xref linkend="ST_Intersects" />), and then compare the intersection's
-                <xref linkend="ST_GeometryType" /> with '<varname>LINESTRING</varname>' (properly
+                dataset representing a road network. It may be required
+                to identify all road segments that cross
+                each other, not at a point, but in a line (perhaps to validate some business rule).
+                In this case <xref linkend="ST_Crosses" /> does not
+                provide the necessary spatial filter, since for
+                linear features it returns <varname>true</varname> only where they cross at a point.
+                </para>
+                <para>A two-step solution
+                would be to first compute the actual intersection
+                (<xref linkend="ST_Intersection" />) of pairs of road lines that spatially
+                intersect (<xref linkend="ST_Intersects" />), and then check if the intersection's
+                <xref linkend="ST_GeometryType" /> is '<varname>LINESTRING</varname>' (properly
                 dealing with cases that return
                 <varname>GEOMETRYCOLLECTION</varname>s of
                 <varname>[MULTI]POINT</varname>s,
-                <varname>[MULTI]LINESTRING</varname>s, etc.).</para> <para>A
-                more elegant / faster solution may indeed be
-                desirable.</para></entry>
+                <varname>[MULTI]LINESTRING</varname>s, etc.).</para>
+                <para>Clearly, a simpler and faster solution is desirable.</para></entry>
               </row>
             </tbody>
           </tgroup>
@@ -1254,15 +1265,15 @@ gisdb=# SELECT
               <row>
                 <entry><para> <informalfigure float="1" floatstyle="right">
                     <graphic align="right" fileref="images/de9im02.png" />
-                  </informalfigure></para> <para>A second [theoretical]
-                example may be that of a GIS analyst trying to locate all
-                wharfs or docks that intersect a lake's boundary on a line and
-                where only one end of the wharf is up on shore. In other
-                words, where a wharf is within, but not completely within a
-                lake, intersecting the boundary of a lake on a line, and where
-                the wharf's endpoints are both completely within and on the
-                boundary of the lake. The analyst may need to use a
-                combination of spatial predicates to isolate the sought after
+                  </informalfigure></para> <para>A second
+                example is locating
+                wharves that intersect a lake's boundary on a line and
+                where one end of the wharf is up on shore. In other
+                words, where a wharf is within but not completely contained by a
+                lake, intersects the boundary of a lake on a line, and where
+                exactly one of the wharf's endpoints is within or on the
+                boundary of the lake. It is possible to use a
+                combination of spatial predicates to find the required
                 features:</para> <itemizedlist>
                     <listitem>
                       <para><xref linkend="ST_Contains" />(lake, wharf) = TRUE</para>
@@ -1281,8 +1292,7 @@ gisdb=# SELECT
                       <para><xref linkend="ST_NumGeometries" />(<xref linkend="ST_Multi" />(<xref linkend="ST_Intersection" />(<xref linkend="ST_Boundary" />(wharf),
                       <xref linkend="ST_Boundary" />(lake)))) = 1</para>
 
-                      <para>... (needless to say, this could get quite
-                      complicated)</para>
+                      <para>... but needless to say, this is quite complicated.</para>
                     </listitem>
                   </itemizedlist></entry>
               </row>
@@ -1290,8 +1300,8 @@ gisdb=# SELECT
           </tgroup>
         </informaltable>
 
-        <para>So enters the Dimensionally Extended 9 Intersection Model, or
-        DE-9IM for short.</para>
+        <para>These requirements can be met by using the
+        Dimensionally Extended 9-Intersection Model (DE-9IM for short).</para>
 
         <sect4>
           <title>Theory</title>
@@ -1305,6 +1315,11 @@ gisdb=# SELECT
           geometries based on the entries in the resulting 'intersection'
           matrix."</para>
 
+        <para>In the theory of point-set topology,
+        the points in a geometry embedded in 2-dimensional space
+        can be categorized into the following sets:
+        </para>
+
           <glosslist>
             <glossentry>
               <glossterm>Boundary</glossterm>
@@ -1313,9 +1328,9 @@ gisdb=# SELECT
                 <para>The boundary of a geometry is the set of geometries of
                 the next lower dimension. For <varname>POINT</varname>s, which
                 have a dimension of 0, the boundary is the empty set. The
-                boundary of a <varname>LINESTRING</varname> are the two
+                boundary of a <varname>LINESTRING</varname> is the two
                 endpoints. For <varname>POLYGON</varname>s, the boundary is
-                the linework that make up the exterior and interior
+                the linework of the exterior and interior
                 rings.</para>
               </glossdef>
             </glossentry>
@@ -1325,10 +1340,10 @@ gisdb=# SELECT
 
               <glossdef>
                 <para>The interior of a geometry are those points of a
-                geometry that are left when the boundary is removed. For
+                geometry that are not in the boundary. For
                 <varname>POINT</varname>s, the interior is the
-                <varname>POINT</varname> itself. The interior of a
-                <varname>LINESTRING</varname> are the set of real points
+                point itself. The interior of a
+                <varname>LINESTRING</varname> is the set of points
                 between the endpoints. For <varname>POLYGON</varname>s, the
                 interior is the areal surface inside the polygon.</para>
               </glossdef>
@@ -1338,29 +1353,63 @@ gisdb=# SELECT
               <glossterm>Exterior</glossterm>
 
               <glossdef>
-                <para>The exterior of a geometry is the universe, an areal
-                surface, not on the interior or boundary of the
-                geometry.</para>
+                <para>The exterior of a geometry is the rest of the space
+                in which the geometry is embedded;
+                in other words, all points not in the interior or on the boundary of the geometry.
+                It is a 2-dimensional non-closed surface.
+                </para>
               </glossdef>
             </glossentry>
           </glosslist>
 
-          <para>Given geometry <emphasis>a</emphasis>, where the
-          <emphasis>I(a)</emphasis>, <emphasis>B(a)</emphasis>, and
-          <emphasis>E(a)</emphasis> are the <emphasis>Interior</emphasis>,
-          <emphasis>Boundary</emphasis>, and <emphasis>Exterior</emphasis> of
-          a, the mathematical representation of the matrix is:</para>
+        <para>The <ulink url="http://en.wikipedia.org/wiki/DE-9IM">Dimensionally Extended 9-Intersection Model</ulink>
+        (DE-9IM) describes the spatial relationship between two geometries
+        by specifying the dimensions of the 9 intersections between the above sets for each geometry.
+        The intersection dimensions can be formally represented
+        in a 3x3 <emphasis role="bold">intersection matrix</emphasis>.
+        </para>
+
+        <para>For a geometry <emphasis>g</emphasis>
+            the <emphasis>Interior</emphasis>, <emphasis>Boundary</emphasis>, and <emphasis>Exterior</emphasis>
+            are denoted using the notation
+          <emphasis>I(g)</emphasis>, <emphasis>B(g)</emphasis>, and
+          <emphasis>E(g)</emphasis>.
+          Also, <emphasis>dim(g)</emphasis> denotes the dimension of
+          <emphasis>g</emphasis> with the domain of
+          <literal>{0,1,2,F}</literal>
+          (as computed by <xref linkend="ST_Dimension" />)
+        </para>
+
+        <itemizedlist spacing="compact">
+        <listitem>
+            <para><literal>0</literal> => point</para>
+        </listitem>
+
+        <listitem>
+            <para><literal>1</literal> => line</para>
+        </listitem>
+
+        <listitem>
+            <para><literal>2</literal> => area</para>
+        </listitem>
+
+        <listitem>
+            <para><literal>F</literal> => empty set</para>
+        </listitem>
+
+        </itemizedlist>
+
+        <para>
+          Using this notation, the intersection matrix
+          for two geometries <emphasis>a</emphasis> and <emphasis>b</emphasis> is:</para>
 
           <informaltable tabstyle="styledtable">
             <tgroup align="center" cols="4">
               <thead>
                 <row>
                   <entry></entry>
-
                   <entry><emphasis role="bold">Interior</emphasis></entry>
-
                   <entry><emphasis role="bold">Boundary</emphasis></entry>
-
                   <entry><emphasis role="bold">Exterior</emphasis></entry>
                 </row>
               </thead>
@@ -1389,40 +1438,7 @@ gisdb=# SELECT
             </tgroup>
           </informaltable>
 
-          <para>Where <emphasis>dim(a)</emphasis> is the dimension of
-          <emphasis>a</emphasis> as specified by
-          <xref linkend="ST_Dimension" /> but has the domain of
-          <literal>{0,1,2,T,F,*}</literal></para>
-
-          <itemizedlist spacing="compact">
-            <listitem>
-              <para><literal>0</literal> => point</para>
-            </listitem>
-
-            <listitem>
-              <para><literal>1</literal> => line</para>
-            </listitem>
-
-            <listitem>
-              <para><literal>2</literal> => area</para>
-            </listitem>
-
-            <listitem>
-              <para><literal>T</literal> =>
-              <literal>{0,1,2}</literal></para>
-            </listitem>
-
-            <listitem>
-              <para><literal>F</literal> => empty set</para>
-            </listitem>
-
-            <listitem>
-              <para><literal>*</literal> => don't care</para>
-            </listitem>
-          </itemizedlist>
-
-          <para>Visually, for two overlapping polygonal geometries, this looks
-          like:</para>
+         <para>Visually, for two overlapping polygonal geometries, this looks like:</para>
 
           <informaltable frame="none" border="0">
             <tgroup cols="2">
@@ -1538,31 +1554,64 @@ gisdb=# SELECT
             </tgroup>
           </informaltable>
 
-          <para>Read from left to right and from top to bottom, the dimensional matrix is
-          represented, '<emphasis role="bold">212101212</emphasis>'.</para>
+          <para>Reading from left to right and from top to bottom, the intersection matrix is
+          represented as '<emphasis role="bold">212101212</emphasis>'.</para>
+
+          <para>
+          PostGIS provides the <xref linkend="ST_Relate" /> function
+          to compute the intersection matrix for two geometries:
+          </para>
+
+          <programlisting>
+SELECT ST_Relate( 'LINESTRING (1 1, 5 5)',
+                  'POLYGON ((3 3, 3 7, 7 7, 7 3, 3 3))' );
+st_relate
+-----------
+1010F0212
+</programlisting>
+
+          <para>
+          To specify more general spatial relationships,
+          an <emphasis role="bold">intersection matrix pattern</emphasis> is used.
+          This is a matrix represention augmented with the additional symbols
+          <literal>{T,*}</literal>:
+            </para>
+
+          <itemizedlist spacing="compact">
+            <listitem>
+              <para><literal>T</literal> =>
+              intersection dimension is non-empty; i.e. is in <literal>{0,1,2}</literal></para>
+            </listitem>
+
+            <listitem>
+              <para><literal>*</literal> => don't care</para>
+            </listitem>
+          </itemizedlist>
 
-          <para>A relate matrix that would therefore represent our first
-          example of two lines that intersect on a line would be: '<emphasis
-          role="bold">1*1***1**</emphasis>'</para>
+          <para>Using intersection matrix patterns and the 3-parameter variant of <xref linkend="ST_Relate" />,
+          specific spatial relationships can be evaluated in a more succinct way.
+          For the first example above, an intersection matrix pattern specifying
+          two lines intersecting in a line is
+          '<emphasis role="bold">1*1***1**</emphasis>':</para>
 
-          <programlisting>-- Identify road segments that cross on a line
+          <programlisting>-- Find road segments that cross on a line
 SELECT a.id
 FROM roads a, roads b
 WHERE a.id != b.id
 AND a.geom && b.geom
 AND ST_Relate(a.geom, b.geom, '1*1***1**');</programlisting>
 
-          <para>A relate matrix that represents the second example of wharfs
-          partly on the lake's shoreline would be '<emphasis
-          role="bold">102101FF2</emphasis>'</para>
+          <para>For the second example, an intersection matrix pattern
+          specifying a line partly inside and partly outside a polygon is
+          '<emphasis role="bold">102101FF2</emphasis>':</para>
 
-          <programlisting>-- Identify wharfs partly on a lake's shoreline
+          <programlisting>-- Find wharves partly on a lake's shoreline
 SELECT a.lake_id, b.wharf_id
 FROM lakes a, wharfs b
 WHERE a.geom && b.geom
 AND ST_Relate(a.geom, b.geom, '102101FF2');</programlisting>
 
-          <para>For more information or reading, see:</para>
+          <para>For more information, refer to:</para>
 
           <itemizedlist spacing="compact">
             <listitem>

-----------------------------------------------------------------------

Summary of changes:
 doc/reference_relationship.xml | 195 +++++++++++++++++++++++----------
 doc/using_postgis_dataman.xml  | 241 +++++++++++++++++++++++++----------------
 2 files changed, 282 insertions(+), 154 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list