0

I have got two geometries one is polygons (postcode boundaries) and second is linestring (roads). I want to intersect them together and want roads that are intersecting the polygons. While doing this I got that many sections of roads are still connected to each other (dissolved). So I want to separate them (explode) as they are in geometry. I did search for the solution but haven't found anything.

This is the case below they all are a one feature in QGIS. I want them as single entity.

enter image description here

2

You can use st_dump() to transform multi-parts to single-parts

SELECT sometable.field1, sometable.field2,
      (ST_Dump(sometable.the_geom)).geom AS the_geom
FROM sometable;
5
  • Thanks for that. But I have run this query. Result is not just satisfactory, Still the same problem.
    – Sri
    Jan 9 '20 at 12:41
  • @Shobhit what do you mean? st_dump is the tool to explode a multi-part to single parts, which is what you have asked... Clarify the question if you want something else
    – JGH
    Jan 9 '20 at 12:46
  • Sorry for any confusion. Like in the photo uploaded their are three links which have a common field i.e. RoadName. I have clipped this Road data with post code boundary but the road segments are still connected due the same name. So I just simply want to separate them as single feature. So that if you select a feature that will show you just one feature not others.
    – Sri
    Jan 9 '20 at 13:22
  • @Shobhit and what is wrong with applying st_dump on the clip output?
    – JGH
    Jan 9 '20 at 14:48
  • It is actually not exploding the geometries. So I have run another method, ST_Union, ST_Multi and then ST_Dump. Because it was not exploding so Merged them then break all of them. I am pretty sure there would be another better method but it worked for me. SELECT sometable.field1, sometable.field2, (ST_Dump(St_multi(ST_Union(sometable.the_geom)))).geom AS the_geom FROM sometable Group By sometable.field1, sometable.field2,; Thanks JGH at least you came forward for help. :)
    – Sri
    Jan 10 '20 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.