<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Another option to handle merging off different simple feature datasets into a single dataset can be Postgis Topology.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">What we basically do is that we pipe the datasets into Postgis Topology which solves the problems related to breaking up lines
 and </span><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background: var(--white);">snap to.</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Then we take the data out as simple Feature from Postgis Topology and the users can continue to work on a nice a clean simple feature dataset. </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt"><br>
</span></div>
<div><font color="#000000" face="Calibri, Arial, Helvetica, sans-serif" size="3">We have done this for datasets containing </font><font color="#000000" face="Calibri, Arial, Helvetica, sans-serif"><span style="caret-color: rgb(0, 0, 0);">millions</span></font><font color="#000000" face="Calibri, Arial, Helvetica, sans-serif" size="3"> of
 points and it works quite nice..</font></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Lars </div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> postgis-users <postgis-users-bounces@lists.osgeo.org> on behalf of paul.malm@lfv.se <paul.malm@lfv.se><br>
<b>Sent:</b> Wednesday, September 4, 2019 1:53 PM<br>
<b>To:</b> postgis-users@lists.osgeo.org <postgis-users@lists.osgeo.org><br>
<b>Subject:</b> Re: [postgis-users] breake lines</font>
<div> </div>
</div>
<div lang="SV">
<div class="x_WordSection1">
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Hi,
</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">If I understand your question correct, yes I would like to break all lines in the intersections with another layer.</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">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:11.0pt; font-family:Wingdings; color:#1F497D">L</span><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"></span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">This is how far I have come:</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">CREATE TABLE splittedlayer3
</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">AS SELECT ST_CollectionExtract(ST_Split(o.the_geom, c.the_geom),2) as the_geom
</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">FROM "orgLayer" o, "cutLayer" c WHERE ST_Intersects(o.the_geom, c.the_geom)</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">But this gives duplicate line segments when intersecting the cutting lines twice.</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">/Paul</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<span lang="EN-US"> </span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
<b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">Från:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org]
<b>För </b>Martin Davis<br>
<b>Skickat:</b> den 3 september 2019 19:18<br>
<b>Till:</b> PostGIS Users Discussion<br>
<b>Ämne:</b> Re: [postgis-users] breake lines</span></p>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
 </p>
<div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
Have you tried using ST_Split passing each input line and for the second argument a MultiLineString comprised of all lines that it might intersect (obtained via BBOX or ST_Intersects query)?  It seems like that should not create any duplicate linework from
 the input line.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
As far as I know there's no other way to do this using current PostGIS functions.   It's an interesting requirement - it sounds like essentially you want to node one layer against another.  There's actually the machinery to do this internally in PostGIS/GEOS,
 but it's never come up as a requirement before, so has not been exposed as a function.  </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
 </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
What is your use case?</p>
</div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
 </p>
<div>
<div>
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif">
On Tue, Sep 3, 2019 at 9:48 AM <<a href="mailto:paul.malm@lfv.se">paul.malm@lfv.se</a>> wrote:</p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0cm 0cm 0cm 6.0pt; margin-left:4.8pt; margin-right:0cm">
<p class="x_MsoNormal" style="margin-top: 0px; margin-bottom: 0px;margin:0cm 0cm 0.0001pt; font-size:12pt; font-family:"Times New Roman",serif; margin-bottom:12.0pt">
If I split lines with another line layer, I will get a lot of duplicaded line segments since the lines could be intersected several times. It is not possible to use update on the table when splitting one geomety to two.<br>
I think it must be possible, but I’m not that skilled in SQL and I’ve not found any examples on the net.<br>
<br>
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>