[postgis-users] Converting a LineString to MultiPoint

Andrea Peri aperi2007 at gmail.com
Sat Jun 19 05:44:59 PDT 2010


HI Mike,

it work very well.

So I reached my scope.

I used this sql:

INSERT INTO public.<table_name multipoint> (id,idrtt,geom) (
    select
        c.id,
        c.idrtt,
        st_union(c.geom)
    from (
		select
			a.id as id,
			a.idrtt as idrtt,
			(ST_DumpPoints(a.geom)).* as geom
		from
			public.<table_name linestring> as a
    ) as c
    group by
        c.id,
        c.idrtt
);


Regards,

Andrea.

>If you have PostGIS 1.5, then you can use ST_DumpPoints:
>http://postgis.refractions.net/docs/ST_DumpPoints.html <http://postgis.refractions.net/docs/ST_DumpPoints.html>
>
>E.g.:
>
>SELECT gid, ST_AsText(ST_Collect(ST_AsText(geom)))
>FROM (
>  SELECT gid, (ST_DumpPoints(g.geom)).*
>  FROM
>    (SELECT 1 as gid, 'LINESTRING (0 0, 0 3, 3 4)'::geometry AS geom
>     UNION ALL
>     SELECT 2 as gid, 'LINESTRING (1 1, 2 6, 7 7)'::geometry AS geom) AS g
>  ) j
>GROUP BY gid;
>
>-Mike



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100619/0462c08f/attachment.html>


More information about the postgis-users mailing list