Alexander Strunck
2009-12-01 08:58:32 UTC
hello
i am new to postgis and sql. my problem is that i want to count the points that are in every polygon. the polygon table contains gid, id, geom. the points table contains id, geom.
i found in the internet this sql
Has anyone an idea how to make this work??
thx
alex
i am new to postgis and sql. my problem is that i want to count the points that are in every polygon. the polygon table contains gid, id, geom. the points table contains id, geom.
i found in the internet this sql
UPDATE polygon SET number_points = foo.count
FROM (
SELECT polygon.name, count(point.gid) AS count
FROM point, polygon
WHERE ST_Contains(polygon.the_geom, point.the_geom)
GROUP BY polygon.name
) AS foo
WHERE polygon.name = foo.name;
but it don´t seem to work for me.FROM (
SELECT polygon.name, count(point.gid) AS count
FROM point, polygon
WHERE ST_Contains(polygon.the_geom, point.the_geom)
GROUP BY polygon.name
) AS foo
WHERE polygon.name = foo.name;
Has anyone an idea how to make this work??
thx
alex
--
Endlich! Das Debüt-Album von Pop-Diva Sarah Kreuz ist da!
Jetzt bei GMX Musik Downloads. http://portal.gmx.net/de/go/musik01
Endlich! Das Debüt-Album von Pop-Diva Sarah Kreuz ist da!
Jetzt bei GMX Musik Downloads. http://portal.gmx.net/de/go/musik01