How do I explode a multilinestring using ST_Dump() in PostGIS?

المشرف العام

Administrator
طاقم الإدارة
I want to do what this blog post does: explode a multilinestring into individual linestrings. I'm using CartoDB but don't get individual linestrings as the result of my query. I still get a multilinesting. I've tried to simplify it by taking out parts I don't understand (like the COALESCE() part) but still haven't gotten it to work.

My code

SELECT COALESCE((simple.trip_id || '.' || simple.path[1]::text)::float, simple.trip_id) as id, simple.simple_geom as geom, ST_GeometryType(simple.simple_geom) as geom_type, ST_AsEWKT(simple.simple_geom) as geom_wktFROM ( SELECT dumped.*, (dumped.geom_dump).geom as simple_geom, (dumped.geom_dump).path as path FROM ( SELECT *, ST_Dump(the_geom) AS geom_dump FROM my_table ) as dumped) AS simpleUltimately, I want to explode my multilinestrings simply to run an intersection function on it so that I can line-offset along parts of multiple line features where they overlap. I also looked at this as a resource.

If anyone could help break down what the SQL above is doing and/or how to tweak it, that'd be great. I'm not sure how the ST_Dump function works.



أكثر...
 
أعلى