[postgis-users] linestring aggregation

Nicolas Gillet - MARKET-IP nicolas.gillet at market-ip.com
Tue Dec 29 06:42:18 PST 2009


Hello

Thanks for the answer,

I knew about ST_touches(geometry, geometry) function.

But I don't know how to use it in my aggregate query to group only the
records that are touching each other

SELECT name, code, geometry_sum(the_geom) FROM roads
GROUP BY name, code, st_touches(???, the_geom)

Or something like that (geometry_sum being my aggregate function).

Any idea ?

Nicolas

-----Message d'origine-----
De : postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] De la part de Sean
Envoyé : mardi 29 décembre 2009 15:34
À : postgis-users at postgis.refractions.net
Objet : Re: [postgis-users] linestring aggregation

Sounds like ST_Touches:
http://postgis.refractions.net/docs/ST_Touches.html


  Sean

On Dec 29, 5:39 am, "Nicolas Gillet - MARKET-IP"
<nicolas.gil... at market-ip.com> wrote:
> Hello
>
> I am trying to aggregate linestrings together based on their attributes
and
> the fact that they are touching each other.
>
> Therefore I found out how to write a very basic aggregate function :
>
>    CREATE AGGREGATE geometry_sum (
>
>                 SFUNC = st_union,
>
>                 BASETYPE = geometry,
>
>                 STYPE = geometry);
>
> I can now aggregate my linestrings grouped by their names, importance, and
> so on but . I have trouble to group them by the fact that they are
touching
> each other.
>
> e.g.
>
> linestring A, B and C have the same attributes but only A and B are
touching
> each other.
>
> I would like as a result A+B in one record, and C in a second record.
>
> Does someone have any tips to share ?
>
> Thank you,
>
> Nicolas
>
> _______________________________________________
> postgis-users mailing list
>
postgis-us... at postgis.refractions.nethttp://postgis.refractions.net/mailman/
listinfo/postgis-users
_______________________________________________
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