Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think my problem is quite easy to be solved by the most postgis-users, but i am a bloody beginner: i have a timestamped point-table representing GPS-tracked places of different cars. To distinguish the cars there is a car-id for every point. So, a simplified version is looking like that:

enter image description here

Now, i want to write a query for connecting the places of each car chronologically with lines so that the track of each car can be displayed. The table is sorted chronologically, so it can be worked with the id's instead of the timestamps. How can I solve it? Thank you in advance!

share|improve this question
up vote 3 down vote accepted

You want to use the ST_MakeLine function. There is an example of almost exactly what you are trying to do (if I have understood you correctly) here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.