<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 4, 2019 at 4:54 AM <<a href="mailto:paul.malm@lfv.se">paul.malm@lfv.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="SV">
<div class="gmail-m_-6028125164424707655WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hi,
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">If I understand your question correct, yes I would like to break all lines in the intersections with another layer.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">No I have not tried MultiLinestrings comprised of all lines that are intersecting the lines to be broken. Don’t know how to do this.
</span><span lang="EN-US" style="font-size:11pt;font-family:Wingdings;color:rgb(31,73,125)">L</span><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> </span></p></div></div></blockquote><div>Here's an example query showing how to collect all cutting lines which intersect each data line and then use them to split the data line:</div><div><br></div><div>WITH<br>data AS (<br>    SELECT * FROM (VALUES<br>        ( 'LINESTRING (100 100, 400 100)'::geometry ),<br>        ( 'LINESTRING (100 300, 400 300)'::geometry ),<br>        ( 'LINESTRING (250 400, 400 400)'::geometry )<br>    ) AS t(geom)<br>),<br>cutter AS (<br>    SELECT * FROM (VALUES<br>        ( 'LINESTRING (150 50, 150 350)'::geometry ),<br>        ( 'LINESTRING (200 50, 200 150)'::geometry ),<br>        ( 'LINESTRING (250 350, 250 250)'::geometry ),<br>        ( 'LINESTRING (300 350, 300 50)'::geometry ),<br>        ( 'LINESTRING (350 250, 350 450)'::geometry )<br>    ) AS t(geom)<br>)<br>SELECT ST_Split( d.geom, <br>            (SELECT ST_Collect(c.geom) geom<br>                FROM cutter c WHERE ST_Intersects(d.geom, c.geom)<br>            )) geom<br>    FROM data d;<br></div><div><br></div><div>I think this should work even if the inputs are MultiLineStrings, but you'll have to verify that.</div><div><br></div><div>One issue that might arise depending on your data is that ST_Split errors out if the splitting line has any portion which is collinear with a portion of the input.  I guess the theoretical rationale for this is that the splitting code doesn't know which "side" of the output to allocate the common line to.  But really this isn't very useful, since there's no easy way to detect this situation and prevent it from happening. If this is an issue for you then report back to the list, and we can think about how to fix this.</div></div></div>