[postgis-users] Simple Point Density Surface
strk at keybit.net
Wed Apr 25 10:18:39 PDT 2012
On Wed, Apr 25, 2012 at 10:15:22AM -0700, JamesH wrote:
> Hi all,
> I am looking to take a point dataset and generate a point density raster in
> PostGIS, similar to the ArcGIS Point Density tool in Spatial Analyst.
> What I believe I need to do is to define a neightbourhood around each output
> raster cell centre and calculate a density value for each pixel based on the
> number of points that fall within that neighbourhood.
> Ideally to recreate the same results, I would like to define a neighbourhood
> with a radius of 8 cells - most likely a square neighbourhood.
> I have been considering this for a while but I really cannot understand how
> to acheive this.
> Any advise or help would be greatly appreciated.
SELECT st_centroid(st_collect(the_geom)), count(*)
GROUP BY ST_SnapToGrid(the_geom, cellsize)
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
More information about the postgis-users