I have a MultiLineString table in PostgreSQL and I am trying to obtain a table with all the segments obtained from those lines if we split them at their vertices. I have found this simple example, which actually works:
SELECT ST_AsText(ST_Split(mline, pt)) As wktcut FROM (SELECT ST_GeomFromText('MULTILINESTRING((10 10, 190 190), (15 15, 30 30, 100 90))') As mline, ST_Point(30,30) As pt) As foo;
But I am struggling to adapt this example to my case.
I am actually trying with something like this:
SELECT ST_AsText(ST_Split(mline, pt)) As wktcut FROM (SELECT geom As mline from public.flood_def, (SELECT (ST_DumpPoints(public.flood_def.geom)).geom As pt FROM public.flood_def)) As foo;
where 'public.flood_def' is the table that contains the multilines. This, unfortunately, doesn't work. It throws a syntax error:
ERROR: subquery in FROM must have an alias LINE 30: (SELECT (ST_DumpPoints(public.flood_def.geom)).geom As ...
Also, I'm finding it hard to understand the documentation about any of the PostGIS ST_xxxx instructions.