From ad39f723d3041be2c3130e3a8ce39614459bcf4c Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Thu, 3 Jul 2008 19:07:35 +0000 Subject: [PATCH] Examples of use of ST_MakeLine, correction to my ST_Collect example. git-svn-id: http://svn.osgeo.org/postgis/trunk@2825 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/postgis.xml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/postgis.xml b/doc/postgis.xml index 445cde444..6bc298a30 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -3178,7 +3178,8 @@ VACUUM FULL ANALYZE mytable; The convex hull of a geometry represents the minimum closed geometry that encloses all geometries within the set. - It is usually used with MULTI and Geometry Collections. Although it is not an aggregate - you can use it in conjunction with ST_Collect to get the convex hull of a set of points. ST_ConvexHull(ST_Collect(somepointfield)). It is often used to determine an affected area based on a set of point observations. + It is usually used with MULTI and Geometry Collections. Although it is not an aggregate - you can use it in conjunction with ST_Collect to get the convex hull of a set of points. + ST_ConvexHull(ST_Collect(somepointfield)). It is often used to determine an affected area based on a set of point observations. SELECT d.disease_type, ST_ConvexHull(ST_Collect(d.the_geom)) As the_geom FROM disease_obs As d @@ -4552,6 +4553,12 @@ dimension Creates a Linestring from a set of point geometries. You might want to use a subselect to order points before feeding them to this aggregate. + +SELECT gps.gps_track, ST_MakeLine(gps.the_geom) As newgeom + FROM (SELECT gps_track,gps_time, the_geom + FROM gps_points ORDER BY gps_track, gps_time) As gps + GROUP BY gps.gps_track + @@ -4560,6 +4567,9 @@ dimension Creates a Linestring from the two given point geometries. + +SELECT ST_AsText(ST_MakeLine(ST_MakePoint(1,2), ST_MakePoint(3,4))) + @@ -4620,8 +4630,8 @@ dimension object from a set of geometries. The collect() function is an "aggregate" function in the terminology of PostgreSQL. That means that it operates on rows of data, in the same way - the sum() and mean() functions do. For example, "SELECT - COLLECT(GEOM) FROM GEOMTABLE GROUP BY ATTRCOLUMN" will + the SUM() and AVG() functions do. For example, "SELECT + ST_Collect(GEOM) FROM GEOMTABLE GROUP BY ATTRCOLUMN" will return a separate GEOMETRYCOLLECTION for each distinct value of ATTRCOLUMN. ST_Collect and ST_Union are often interchangeable. @@ -4670,8 +4680,8 @@ GROUP BY stusps it creates new rows. For example it can be use to expand MULTIPOLYGONS into POLYGONS. -SELECT sometable.*, (ST_Dump(the_geom)).geom As the_geom - FROM somestatetable +SELECT sometable.field1, sometable.field1, (ST_Dump(sometable.the_geom)).geom As the_geom + FROM sometable -- 2.50.1