From: Regina Obe Date: Wed, 27 Jul 2011 11:52:51 +0000 (+0000) Subject: example of using new PostgreSQL 9.0+ ORDER BY aggregate feature for ST_MakeLine X-Git-Tag: 2.0.0alpha1~1165 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffe153c10a3564955f7c4fb023fb3d87c64efbf3;p=postgis example of using new PostgreSQL 9.0+ ORDER BY aggregate feature for ST_MakeLine git-svn-id: http://svn.osgeo.org/postgis/trunk@7681 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_constructor.xml b/doc/reference_constructor.xml index 3386e946f..3bdff3214 100644 --- a/doc/reference_constructor.xml +++ b/doc/reference_constructor.xml @@ -1224,7 +1224,15 @@ BOX3D(-989502.1875 528439.5625 10,-987121.375 529933.1875 10) 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 + GROUP BY gps.gps_track; + + +-- If you are using PostgreSQL 9.0+ +-- (you can use the new ORDER BY support for aggregates) +-- this is a more guaranteed way to get ordered linestring +SELECT gps.gps_track, ST_MakeLine(gps.the_geom ORDER BY gps_track,gps_time) As newgeom + FROM gps_points + GROUP BY gps.gps_track; Examples: Non-Spatial Aggregate version