[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-9-g000728d

git at osgeo.org git at osgeo.org
Wed Dec 16 16:59:37 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  000728dfda4b2b57eda4f809b029d19e68d95001 (commit)
      from  16da653cbf29c4a1d6915462723948b6804b5f14 (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 000728dfda4b2b57eda4f809b029d19e68d95001
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Wed Dec 16 16:59:33 2020 -0800

    Improve doc for ST_MultiPolygon

diff --git a/doc/reference_constructor.xml b/doc/reference_constructor.xml
index d231952..079a5b8 100644
--- a/doc/reference_constructor.xml
+++ b/doc/reference_constructor.xml
@@ -578,54 +578,58 @@ SELECT ST_MakePolygon( ST_ExteriorRing( ST_Buffer(ring.line,10)),
 FROM (SELECT ST_ExteriorRing(
 	ST_Buffer(ST_MakePoint(10,10),10,10)) AS line ) AS ring;
 </programlisting>
-		<para>Create a set of province boundaries with holes
-		representing lakes.  The input is a table of
-		province Polygons/MultiPolygons and a table of water linestrings.
-		Using a LEFT JOIN ensures all provinces are included even if they have no lakes.
-		</para>
-
-		<note><para>The CASE construct is used because passing a null array into
-		ST_MakePolygon results in a NULL return value.</para></note>
+    <para>Create a set of province boundaries with holes
+    representing lakes.  The input is a table of
+    province Polygons/MultiPolygons and a table of water linestrings.
+    Lines forming lakes are determined by using <xref linkend="ST_IsClosed" />.
+    The province linework is extracted by using
+    <xref linkend="ST_Boundary" />.
+    As required by <code>ST_MakePolygon</code>,
+    the boundary is forced to be a single LineString by using <xref linkend="ST_LineMerge" />.
+    (However, note that if a province has more than one region or has islands
+    this will produce an invallid polygon.)
+    Using a LEFT JOIN ensures all provinces are included even if they have no lakes.
+    </para>
+
+    <note><para>The CASE construct is used because passing a null array into
+    ST_MakePolygon results in a NULL return value.</para></note>
 
 		<programlisting>
-	SELECT p.gid, p.province_name,
-		CASE WHEN array_agg(w.the_geom) IS NULL
-		THEN p.the_geom
-		ELSE  ST_MakePolygon( ST_LineMerge(ST_Boundary(p.the_geom)), array_agg(w.the_geom)) END
-	FROM
-		provinces p LEFT JOIN waterlines w
-			ON (ST_Within(w.the_geom, p.the_geom) AND ST_IsClosed(w.the_geom))
-	GROUP BY p.gid, p.province_name, p.the_geom;
+SELECT p.gid, p.province_name,
+	CASE WHEN array_agg(w.geom) IS NULL
+	THEN p.geom
+	ELSE  ST_MakePolygon( ST_LineMerge(ST_Boundary(p.geom)),
+                        array_agg(w.geom)) END
+FROM
+	provinces p LEFT JOIN waterlines w
+		ON (ST_Within(w.geom, p.geom) AND ST_IsClosed(w.geom))
+GROUP BY p.gid, p.province_name, p.geom;
 </programlisting>
 
 	<para>Another technique is to utilize a correlated subquery
 	and the ARRAY() constructor that converts a row set to an array.</para>
 <programlisting>
-	SELECT p.gid,  p.province_name,
-		CASE WHEN EXISTS( SELECT w.the_geom
-			FROM waterlines w
-			WHERE ST_Within(w.the_geom, p.the_geom)
-			AND ST_IsClosed(w.the_geom))
-		THEN ST_MakePolygon(
-			ST_LineMerge(ST_Boundary(p.the_geom)),
-			ARRAY( SELECT w.the_geom
-				FROM waterlines w
-				WHERE ST_Within(w.the_geom, p.the_geom)
-				AND ST_IsClosed(w.the_geom)))
-		ELSE p.the_geom
-		END AS the_geom
-	FROM provinces p;
+SELECT p.gid,  p.province_name,
+    CASE WHEN EXISTS( SELECT w.geom
+        FROM waterlines w
+        WHERE ST_Within(w.geom, p.geom)
+        AND ST_IsClosed(w.geom))
+    THEN ST_MakePolygon(
+        ST_LineMerge(ST_Boundary(p.geom)),
+        ARRAY( SELECT w.geom
+            FROM waterlines w
+            WHERE ST_Within(w.geom, p.geom)
+            AND ST_IsClosed(w.geom)))
+    ELSE p.geom
+    END AS geom
+FROM provinces p;
 </programlisting>
 		</refsection>
 		<refsection>
 			<title>See Also</title>
 			<para>
-				<xref linkend="ST_Boundary" />,
-				<xref linkend="ST_AddPoint" />,
-				<xref linkend="ST_IsClosed" />,
-				<xref linkend="ST_LineMerge" />,
-				<xref linkend="ST_StartPoint" />,
 				<xref linkend="ST_BuildArea" />
+				<xref linkend="ST_Polygon" />
 			</para>
 		</refsection>
 	</refentry>

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

Summary of changes:
 doc/reference_constructor.xml | 74 +++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list