[postgis-users] Make line from points...

LuVar varga.lubomir at orangemail.sk
Fri Dec 7 05:35:56 PST 2007


Hi. I have table with points. The points reprezents my ride on bike...

table of points:

id    |   possition   |   time    |  trip   | speed
---------------------------------------------------
0     |  point        | datetime  | null    |  12.33 km/h


The possition I insert somethink like this:
insert ... GeomFromText('POINT(4972.90 5005.85)',-1)) ...
time is datetime from my GPS device...
trip is allways null.

This is nice. But after I insert a few points from trip (this is done
on the fly, by bluetooth) I want to split my points to trips...

So I want to copy (move) my data to another table. First I mark the
points as a trip (I find groups of points with speed not null, and I
give them some trip number. So trip collumn wil not be numll) and than
I want to make some:

GeomFromText('LINE((4972.90 5005.85,4974.08 5007.98,4973.49 5008.31,4972.31 5006.18,4972.90 5005.85))',-1));

and store it to some trips table. I want to do this, because I want to
postgis to calculate length of trip to me, which is possible only from
line (if I am not wrong).

trips table:

id    |  tripDate   |   timeLenght   | lenghtOfTrip   | averageSpeed
--------------------------------------------------------------------
0     | datetime    |   1h 25m       | 7.5 km         | 5 km/h


how can I convert rows with equal trip collumn from table of points,
to one row in trips table? Is it possible to do it by sql query? (If
not, I probbably make it in my program)

PS: Do you think, that this way (style) of solving this problem is the
best? (If no, please, give me some hints)





More information about the postgis-users mailing list