Skip to content

Instantly share code, notes, and snippets.

@alrocar
Created April 30, 2017 19:14
Show Gist options
  • Save alrocar/cd791b51fc2e5239792a871649326fba to your computer and use it in GitHub Desktop.
Save alrocar/cd791b51fc2e5239792a871649326fba to your computer and use it in GitHub Desktop.
Join points with PostGIS
SELECT cartodb_id, ele, time, ST_MAKELINE(the_geom,the_geom2) as the_geom FROM (
SELECT cartodb_id, row_number() OVER w AS ele, time, the_geom, lead(the_geom) OVER w AS the_geom2
FROM TRACK_POINTS WINDOW w AS (PARTITION BY track_fid ORDER BY cartodb_id) ) as q
WHERE the_geom2 IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment