[postgis-users] Split multi-linestrings

Maxime van Noppen maxime at altribe.org
Wed Aug 19 06:31:04 PDT 2009


Hi,

On 08/19/09 15:11, Ben Madin wrote:
> Thanks Fred,
> 
> I have also had this problem, but I don't understand how to handle the
> 'set' that is returned.

ST_Dump should return a two-column list :

> # SELECT ST_Dump('MULTILINESTRING((0 0, 10 10, 20 20), (100 100, 200 200, 300 300))');
>                                                          st_dump                                                          
> --------------------------------------------------------------------------------------------------------------------------
>  ({1},010200000003000000000000000000000000000000000000000000000000002440000000000000244000000000000034400000000000003440)
>  ({2},01020000000300000000000000000059400000000000005940000000000000694000000000000069400000000000C072400000000000C07240)

The interesting part is the 2nd column which is the geometry. It's in
the 'geom' field :

> # SELECT astext((ST_Dump('MULTILINESTRING((0 0, 10 10, 20 20), (100 100, 200 200, 300 300))')).geom);
>                astext                
> -------------------------------------
>  LINESTRING(0 0,10 10,20 20)
>  LINESTRING(100 100,200 200,300 300)

-- 
Maxime



More information about the postgis-users mailing list