Hi,

I am dealing with some thematic map to be rendered with mapserver.

I am actually using mapserver data access connection methods (
http://mapserver.org/it/input/vector/postgis.html#data-access-connection-method
)
to perform joins between geometry and attributes tables using mostly
aggregate functions.

I would like to use postgis views to put all the logic in the database but
I am not sure I am doing it in the right way.

I want to count the number of points in table A falling in each polygon in
table B, thus obtaining a polygon table with an attribute. Here follows my
view definition I would like to have feedback on:

SELECT subquery.the_geom::geometry(MultiPolygon,32632) AS the_geom,
count(s.count_att)
FROM table1 A
JOIN ( SELECT the_geom, gid FROM table2 B) subquery
ON A.id = subquery.id
GROUP BY subquery.the_geom;

Regards
/raffaele
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to