From: Regina Obe Date: Mon, 7 Jul 2008 11:57:11 +0000 (+0000) Subject: Add examples for ST_MakePolygon, correct non-st to ST references in ST_MakePolygon... X-Git-Tag: 1.4.0b1~868 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a44983ceaf522f4e1a0a74ebf8ae6418bc6a493;p=postgis Add examples for ST_MakePolygon, correct non-st to ST references in ST_MakePolygon section git-svn-id: http://svn.osgeo.org/postgis/trunk@2828 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/postgis.xml b/doc/postgis.xml index 6e7f9e464..8b8e6c7e5 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -4579,15 +4579,42 @@ SELECT ST_AsText(ST_MakeLine(ST_MakePoint(1,2), ST_MakePoint(3,4))) - - ST_MakePolygon(linestring, [linestring[]]) + + ST_MakePolygon(linestring geometry) + + Creates a Polygon formed by the given shell. Input geometries must be closed + LINESTRINGS (see ST_IsClosed and + ST_GeometryType). This function will not accept a MULTILINESTRING. + +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 + + + + + ST_MakePolygon(linestring geometry, linestrings geometry[]) Creates a Polygon formed by the given shell and array of holes. You can construct a geometry array using Accum. Input geometries must be closed - LINESTRINGS (see IsClosed and - GeometryType). + linkend="Accum">ST_Accum or the PostgreSQL ARRAY[] and ARRAY() constructs. Input geometries must be closed + LINESTRINGS (see ST_IsClosed and + ST_GeometryType). + +--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 +