[postgis-users] Makeline help

Paragon Corporation lr at pcorp.us
Tue Oct 12 10:06:41 PDT 2010


Use ST_MakeLine

http://www.bostongis.com/postgis_makeline.snippet

If you are using PostgreSQL 9.0 its even easier since you can use the new
Ordered aggregates feature and not need the subselect

So PostgreSQL 9.0 implementation would look like

SELECT Event_ID, ST_MakeLine(the_point ORDER BY time)  as the_route
FROM vehicle_tracking_data
GROUP BY Event_ID;

Leo and Regina
http://www.postgis.us
 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
dicky1980
Sent: Tuesday, October 12, 2010 5:15 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Makeline help


Hi,

I need a bit of advice with the st_makeline function.

We have some vehicle tracking data showing gritting activity. What we want
to do is join up the points to create lines showing a travel path of what
has been gritted. We can do a basic version of this but what we'd like is a
seperate line for each group of events

For eaxmple we have

EVENT_ID Time
1             12.00
1             12:01
1             12:02 etc
1
1
2
2
2
2
1
1

What we'd like to be able to do is have it draw one line for the first event
id group of 1s, then stop, draw a line for 2's, stop that line then start a
new line for the next group of ones. What we have a present either jopins
them all as one line, or if we just pull out aal the ones it will draw a
line from the last 1 before the the two then join it to the next instance of
one giving a untrue picture
--
View this message in context:
http://old.nabble.com/Makeline-help-tp29941457p29941457.html
Sent from the PostGIS - User mailing list archive at Nabble.com.

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list