[postgis-users] How do you do neighborhood functions?

collin collin at socrates.Berkeley.EDU
Tue Apr 13 09:48:18 PDT 2004


Greetings folks,

Question:  I would like to find the average height (z2) of all the 
points within 10 meters of every point.  Any ideas on how to do this?
I have point data from lidar (snippet below).  I made point geometry 
from the raw data. 
           time      |          x2         |          y2       |      
z2   |  int2 |                      geom2
       
-------------+-----------------+----------------+---------+------+-------------------------------------------------
161626.12404 | 10568414.29 |      4247026 | 388.2   |   75 | 
SRID=32610;POINT(10568414.29 4247026 388.2)
161626.12407 | 10568414.31 |      4247026 | 388.26 |   74 | 
SRID=32610;POINT(10568414.31 4247026 388.26)
161626.1241   | 10568414.33 | 4247026.01 | 388.33 |   75 | 
SRID=32610;POINT(10568414.33 4247026.01 388.33)

I tried
    UPDATE napatest SET z2avg10 = avg(z2) 
    WHERE point_inside_circle(geom_point_first, xf, yf, 10);
but this only updated a single row.  z2avg10 is a new field I had added.

Is there a standard method for performing neighborhood functions? i.e. 
any set of statistics for each and every row about their neighboring points.

thanks in advance,

Collin
GIS informatics researcher, UC Berkeley




More information about the postgis-users mailing list