From: Regina Obe Date: Mon, 7 Jul 2008 12:20:43 +0000 (+0000) Subject: Example of ST_AddPoint, some fixes of non-ST references, miscellaneous indenting... X-Git-Tag: 1.4.0b1~867 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5cb64e3443d1035721bed8ff55bf3eb740e5a382;p=postgis Example of ST_AddPoint, some fixes of non-ST references, miscellaneous indenting changes. git-svn-id: http://svn.osgeo.org/postgis/trunk@2829 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/postgis.xml b/doc/postgis.xml index 8b8e6c7e5..a8db19fec 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -4608,7 +4608,8 @@ SELECT ST_GeomFromText('LINESTRING(75.15 29.53,77 29,77.6 29.5)') As open_line) --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)) ] + 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)) @@ -4705,7 +4706,8 @@ GROUP BY stusps it creates new rows. For example it can be use to expand MULTIPOLYGONS into POLYGONS. -SELECT sometable.field1, sometable.field1, (ST_Dump(sometable.the_geom)).geom As the_geom +SELECT sometable.field1, sometable.field1, +(ST_Dump(sometable.the_geom)).geom As the_geom FROM sometable @@ -4758,12 +4760,22 @@ SELECT sometable.field1, sometable.field1, (ST_Dump(sometable.the_geom)).geom As - ST_AddPoint(linestring, point, [<position>]) + ST_AddPoint(linestring geometry, point geometry) + ST_AddPoint(linestring geometry, point geometry, position integer) - Adds a point to a LineString before point <pos> + Adds a point to a LineString before point <position> (0-based index). Third parameter can be omitted or set to -1 for appending. + +--guarantee all linestrings in a table are closed +--by adding the start point of each linestring to the end of the line string +--only for those that are not closed +UPDATE sometable + SET the_geom = ST_AddPoint(the_geom, ST_StartPoint(the_geom)) + FROM sometable + WHERE ST_IsClosed(the_geom) = false; + @@ -5190,9 +5202,9 @@ z' = z This method is a subcase of The extent() function is an "aggregate" function in the terminology of PostgreSQL. That means that it operators on lists of data, in the same way the sum() and mean() functions - do. For example, "SELECT EXTENT(GEOM) FROM GEOMTABLE" - will return a BOX3D giving the maximum extend of all features in - the table. Similarly, "SELECT EXTENT(GEOM) FROM GEOMTABLE + do. For example, "SELECT ST_Extent(GEOM) FROM GEOMTABLE" + will return a BOX3D giving the maximum extent of all features in + the table. Similarly, "SELECT ST_Extent(GEOM) FROM GEOMTABLE GROUP BY CATEGORY" will return one extent result for each category.