Hi,<div><br></div><div>I am dealing with some thematic map to be rendered with mapserver.</div><div><br></div><div>I am actually using mapserver data access connection methods ( <a href="http://mapserver.org/it/input/vector/postgis.html#data-access-connection-method">http://mapserver.org/it/input/vector/postgis.html#data-access-connection-method</a> ) to perform joins between geometry and attributes tables using mostly aggregate functions.</div>
<div><br></div><div>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. </div><div><br></div><div>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:</div>
<div><br></div><div><div>SELECT subquery.the_geom::geometry(MultiPolygon,32632) AS the_geom, count(s.count_att)</div><div>FROM table1 A </div><div>JOIN ( SELECT the_geom, gid FROM table2 B) subquery </div><div>ON A.id = <a href="http://subquery.id">subquery.id</a></div>
<div>GROUP BY subquery.the_geom;</div></div><div><br></div><div>Regards</div><div>/raffaele</div>