[postgis-users] create a single multilinestring field from a column of linestring

Nicolas Ribot nicolas.ribot at gmail.com
Mon Nov 26 09:15:01 PST 2012


By grouping by ID, you ask to generate as many rows as there are distinct
ids in the table.

You could add a surrounding query collecting the grouped linestring to get
only one row:

select st_collect(
        SELECT ST_Multi(ST_Collect(geom_way)) as singlegeom
 FROM emily_route
         group by id

On 26 November 2012 16:56, Raffaello Bertini <raffaellobertini at gmail.com>wrote:

> Hi there,
> I need to create a field multilinestring / linestring, where the values
> are taken from a column of linestring
> I need a result that consist in only one row and one col.
> here my snipett sql:
> SELECT ST_AsText(ST_Multi(ST_Collect(geom_way))) as singlegeom
>  FROM emily_route
> group by id
>  but there are many rows as the table itself. and i don't know even if the
> 'singlegeom' is the
> "array of the all the geometry in the emili_route table".
> If i remove the group by the results is an empty table 1x1 (only the table
> dimension is right:))
> any helps please?
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121126/3bbb8af4/attachment.html>

More information about the postgis-users mailing list