[postgis-users] Converting a LineString to MultiPoint

Mike Toews mwtoews at gmail.com
Thu Jun 17 16:36:52 PDT 2010


If you have PostGIS 1.5, then you can use ST_DumpPoints:
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

On 17 June 2010 14:57, Andrea Peri 2007 <aperi2007 at gmail.com> wrote:
> Hi,
>
> I have a table of LineStrings, and need to create a table of MultiPoints,
> where every multipoint is using the same vertex of a LineString.
> There is a method to do this using only sql ?
>
> Thx,
>
> Andrea.
>
> _______________________________________________
> 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