[postgis-users] st_union and simple line merge

Nicklas Avén nicklas.aven at jordogskog.no
Fri Dec 4 06:13:49 PST 2009


Hallo
 
I found that st_union makes no effort to avoid multilinestring from st_union(linestring, linestring)
 
Is this expected?
 
an example:
select st_astext(st_union('LINESTRING(1 1, 5 5)'::geometry, 'LINESTRING(5 5, 10 5)'::geometry));
 
returns MULTILINESTRING((1 1,5 5),(5 5,10 5))
 
and worst for practical cases if we input the linestrings in opposite order
 
select st_astext(st_union( 'LINESTRING(5 5, 10 5)'::geometry, 'LINESTRING(1 1, 5 5)'::geometry));
 
we get:
 
"MULTILINESTRING((5 5,10 5),(1 1,5 5))"

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. 
 
Is this the expected bahavior, is there any other way to merge simple linestrings to new linestrings?
 
Thanks
Nicklas
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20091204/e141a9c9/attachment.html>


More information about the postgis-users mailing list