<html>
<head>
        <title></title>
        
<meta name="GENERATOR" content="MSHTML 8.00.6001.18852"></meta>
</head>

<body>ok, I found:
        
<div align="left">ST_LineMerge()</div>
        
<div align="left"> </div>
        
<div align="left">I just expected that funtionality to be built in st_union but it will solve my problem :-)</div>
        
<div align="left"> </div>
        
<div align="left">/Nicklas</div>
        
<div align="left"><br />
                <br />
                2009-12-04 Nicklas Avén wrote:<br />
                <br />
                ></div>
        
<div>Hallo</div>>
        
<div> </div>>
        
<div>I found that st_union makes no effort to avoid multilinestring from st_union(linestring, linestring)</div>>
        
<div> </div>>
        
<div>Is this expected?</div>>
        
<div> </div>>
        
<div>an example:</div>>
        
<div>select st_astext(st_union('LINESTRING(1 1, 5 5)'::geometry, 'LINESTRING(5 5, 10 5)'::geometry));</div>>
        
<div> </div>>
        
<div>returns MULTILINESTRING((1 1,5 5),(5 5,10 5))</div>>
        
<div> </div>>
        
<div>and worst for practical cases if we input the linestrings in opposite order</div>>
        
<div> </div>>
        
<div>select st_astext(st_union( 'LINESTRING(5 5, 10 5)'::geometry, 'LINESTRING(1 1, 5 5)'::geometry));</div>>
        
<div> </div>>
        
<div>we get:</div>>
        
<div> </div>>
        
<div>"MULTILINESTRING((5 5,10 5),(1 1,5 5))"<br />
                ></div>>
        
<div>This is not described in the documentation but it says that st_union will try to dissolv boudaries, and I can't imagine any simplier case to dissolv boundaries than this. </div>>
        
<div> </div>>
        
<div>Is this the expected bahavior, is there any other way to merge simple linestrings to new linestrings?</div>>
        
<div> </div>>
        
<div>Thanks</div>>
        
<div>Nicklas</div>>
        
<div> </div>>
        
<div> </div>>
        
<div> </div>>
        
<div> </div>
</body>
</html>