[postgis-users] MakeLine question

Markus Schaber schabi at logix-tt.com
Mon Nov 27 06:21:36 PST 2006

Hi, Curtis,

Curtis W. Ruck wrote:
> I have a table with gps tracks stored as points, each point being one
> data record for every second.
> I am trying to write a view which generates a polyline for each track. 
> I know I need to "select MakeLine(the_geom) from track_log" but the
> postgis documentation suggests "You might want to use a subselect to
> order points before feeding them to this aggregate."
> Does anyone have an example of how to do this, the postgres
> documentation doesn't show an example of using a subquery in the SELECT
> list portion of the query.

One way would be:

SELECT track_id, MakeLine(the_geom) FROM (SELECT track_id, the_geom FROM
track_log ORDER BY seconds) AS foo GROUP BY track_id;


Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org

More information about the postgis-users mailing list