[postgis-users] newbie questions

Benedetto Porfidia benedetto.porfidia at apat.it
Mon May 29 08:36:23 PDT 2006


Hi all,
I have 300000 points table and I want to calculate for each point the average of a field of other points within 4 km radius.
I tried: 

 SELECT a.gid AS id, avg(b.anom267) AS avg, stddev(b.anom267) AS stddev
   FROM provino a, provino b
  WHERE distance(a.the_geom, b.the_geom) < 4000::double precision
  GROUP BY a.gid;

First problem is about performance (it takes 15 hours) and the second is that it returns results only for points that have neighbours within the search radius. how can I tell postgis to put avg=anom267 and stddev = 0 for all isolated points?

which is the right sintax to perform the query on 3dboxes to speed up (I hope)?

thanx in advance

Benedetto 




More information about the postgis-users mailing list