[postgis-commits] svn - r2828 - trunk/doc

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Jul 7 04:57:11 PDT 2008


Author: robe
Date: 2008-07-07 04:57:11 -0700 (Mon, 07 Jul 2008)
New Revision: 2828

Modified:
   trunk/doc/postgis.xml
Log:
Add examples for ST_MakePolygon, correct non-st to ST references in ST_MakePolygon section

Modified: trunk/doc/postgis.xml
===================================================================
--- trunk/doc/postgis.xml	2008-07-06 07:22:51 UTC (rev 2827)
+++ trunk/doc/postgis.xml	2008-07-07 11:57:11 UTC (rev 2828)
@@ -4579,15 +4579,42 @@
             </listitem>
           </varlistentry>
 
-          <varlistentry>
-            <term>ST_MakePolygon(linestring, [linestring[]])</term>
+		  <varlistentry>
+            <term>ST_MakePolygon(linestring geometry)</term>
 
             <listitem>
+              <para>Creates a Polygon formed by the given shell. Input geometries must be closed
+              LINESTRINGS (see <link linkend="IsClosed">ST_IsClosed</link> and
+              <link linkend="GeometryType">ST_GeometryType</link>). This function will not accept a MULTILINESTRING.</para>
+			  <programlisting>
+SELECT ST_MakePolygon(ST_GeomFromText('LINESTRING(75.15 29.53,77 29,77.6 29.5, 75.15 29.53)'));
+--If linestring is not closed
+--you can add the start point to close it
+SELECT ST_MakePolygon(ST_AddPoint(foo.open_line, ST_StartPoint(foo.open_line)))
+FROM (
+SELECT ST_GeomFromText('LINESTRING(75.15 29.53,77 29,77.6 29.5)') As open_line) As foo
+			  </programlisting>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>ST_MakePolygon(linestring geometry, linestrings geometry[])</term>
+            <listitem>
               <para>Creates a Polygon formed by the given shell and array of
               holes. You can construct a geometry array using <link
-              linkend="Accum">Accum</link>. Input geometries must be closed
-              LINESTRINGS (see <link linkend="IsClosed">IsClosed</link> and
-              <link linkend="GeometryType">GeometryType</link>).</para>
+              linkend="Accum">ST_Accum</link> or the PostgreSQL ARRAY[] and ARRAY() constructs. Input geometries must be closed
+              LINESTRINGS (see <link linkend="IsClosed">ST_IsClosed</link> and
+              <link linkend="GeometryType">ST_GeometryType</link>).</para>
+			  <programlisting>
+--Build a donut with an ant hole
+SELECT ST_MakePolygon(
+		ST_ExteriorRing(ST_Buffer(foo.line,10)),
+		ARRAY[ST_Translate(foo.line,1,1),ST_ExteriorRing(ST_Buffer(ST_MakePoint(20,20),1)) ]
+	)
+FROM 
+	(SELECT ST_ExteriorRing(ST_Buffer(ST_MakePoint(10,10),10,10))
+		As line )
+		As foo	
+			  </programlisting>
             </listitem>
           </varlistentry>
 



More information about the postgis-commits mailing list