Skip to content

Instantly share code, notes, and snippets.

@kovid-rathee
Created February 24, 2019 09:16
Show Gist options
  • Save kovid-rathee/7258d9594983f1c0454b5804d4a29164 to your computer and use it in GitHub Desktop.
Save kovid-rathee/7258d9594983f1c0454b5804d4a29164 to your computer and use it in GitHub Desktop.
Example from https://postgis.net/docs/ST_DumpPoints.html to Explode Linestring into Points
select edge_id,
(dp).path[1] As index,
ST_AsText((dp).geom) As wktnode
from (select 1 As edge_id,
ST_DumpPoints(ST_GeomFromText('LINESTRING(1 2, 3 4, 10 10)')) as dp
union all
select 2 As edge_id,
ST_DumpPoints(ST_GeomFromText('LINESTRING(3 5, 5 6, 9 10)')) as dp
) as foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment