1

I have GPS locations with date. These are points.

I want to convert the points to lines, sorted by date.

Using PostgreSQL

Tried:

SELECT observations.id,
       ST_MakeLine(observations.geom ORDER BY observations.date) AS newgeom
FROM   observations 
GROUP BY
       observations.id
;

The problem is that the single line values gives the same coordinates. So, there will be no line. 0 and 1 are the same.

enter image description here

How is this possible?

  • 1
    order by geom first then by date > blog.cleverelephant.ca/2017/09/postgis-operators.html 'ST_MakeLine(observations.geom ORDER BY observations.geom) AS geom FROM observations GROUP BY observations.date' – Mapperz Oct 17 '19 at 1:10
  • @ Mapperz, this is not working. When i give: SELECT ST_MakeLine(observations.geom ORDER BY observations.geom) AS geom FROM observations GROUP BY observations.date; The problem is the same. – Tim van Heteren Oct 17 '19 at 6:53