[postgis-users] Linestring to Multilinestring

Kevin Neufeld kneufeld at refractions.net
Sun Oct 4 17:52:52 PDT 2009


ST_Union also accepts a set.  Attribute the linestrings with some common 
attribute and GROUP BY that attribute.

SELECT attr, ST_Multi(ST_Union(the_geom)) AS multi_ls_geom
FROM my_linestring_table
GROUP BY attr;

Cheers,
Kevin

Mehmet Sirin wrote:
> Hi !
> I got some linestrings which I want to merge into a multilinestring.
> I tried something like this :
> SELECT AsText(ST_UNION(
> ST_GeomFromText('LINESTRING(1 2 ,2 
> 7)'),ST_GeomFromText('LINESTRING(1.5 7, 6.5 10)')) )
>
> and it worked. But now I saw that in some cases I have more than just 
> 2 linestrings. Too bad that St_union only accepts 2geometries:
> ST_UNION(ST_GeomFromText(geometry1, geometry2) )
> And thats where my problem starts. Anybody knows how to merge more 
> than 2 Linestring into a Multilinestring?
> I'm using Postgis 1.3
> best regards
> Mehmet Sirin
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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