[postgis-users] Collect overlapping polygon IDs

Andreas Forø Tollefsen andreasft at gmail.com
Thu Sep 30 02:35:19 PDT 2010


Fantastic. That was exactly what i needed. I managed to get the count, but
the ARRAY_AGG() was new to me.
A great function indeed.

Andreas

2010/9/30 Nicklas Avén <nicklas.aven at jordogskog.no>

> Something like this should work:
>
>
>
> SELECT count(*) as number_of_conflicts, array_agg(b.id) as id_of_conflicts
> FROM conflict_zoones a , vector_grid b WHERE ST_Intersects(a.the_geom,
> b.the_geom) GROUP BY b.id;
>
> array_agg will give you an array looking something like:
> {13, 23, 54}
>
>
>
> HTH
> Nicklas
>
>
>
> 2010-09-30 Andreas Forø Tollefsen wrote:
>
> Hi all,>
>
> >
> >
> I have a table of circular polygons which represents conflict zones within
> countries and a global vector grid with 0.5 x 0.5 decimal degree grid cells
> (square polygons).
> >
>
> >
> >
> What i need to figure out is for each 0.5 x 0.5 grid cell, how many of
> these conflict zones intersect, and the ID of each of them.
> >
> Preferably the result should be a column with the number of intersecting
> circular conflict polygons, and a column with the id of all of them
> separated by a comma.
> >
>
> >
> >
> I cannot get my head around how to structure this?
> >
>
> >
> >
> Any ideas?
> >
>
> >
> >
> Andreas
> >
>
> >
> >
>
> >
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100930/7d5edeba/attachment.html>


More information about the postgis-users mailing list