[postgis-users] st_union and simple line merge

Paul Ramsey pramsey at cleverelephant.ca
Fri Dec 4 08:26:49 PST 2009


ST_LineMerge dissolves linestrings the way you want... We're
inheriting the semantics of Union from JTS. It's possible that we
should be delegating to linemerge in line/line cases. That would be a
big behavior change, however.

P

On Fri, Dec 4, 2009 at 6:13 AM, Nicklas Avén <nicklas.aven at jordogskog.no> wrote:
> 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
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



More information about the postgis-users mailing list