[postgis-users] Thematic map and spatial joins
Raffaele Morelli
raffaele.morelli at gmail.com
Mon Jun 3 02:50:33 PDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130603/035e8130/attachment.html>
More information about the postgis-users
mailing list