[GRASSLIST:1157] Re: density surface from points in PostGIS
RafDouglas Candidi Tommasi Crudeli
ct at ns2.ehleng.com
Wed Sep 10 05:26:05 EDT 2003
At 11.00 10/09/2003 +0200, uli wrote:
>Hi list
>
>New to GRASS but with a pressing geostatistical task I hope for your help:
>
>I have a PostGIS table with some hundreds of points (x,y, no other
>attributes). I need to calculate the "density" of points within a given
>radius for each cell of a grid. "Density" here simply means the number of
>points, nothing like kernel or interpolations.
>The output can be in GRASS format or PostGIS or anything else.
>
>What is the fastset way to do this?
>Do I need GRASS, or are you aware of any other more compact tools?
>Or do you have an idea for a fast SQL-statement doing the job?
>
>Thank you, Uli
not a full answer, but:
for finding the count of points on a regular mesh:
cat $LOCATION/sites_list/sites.s | awk -F"|" '{
x=int($1/100)
y=int($2/100)
print x,y}' |sort -nk1,2 | uniq -c | awk '{print $1"|"$2"|#"$3}'>count.s
where 100 are the x-step and y-step of the mesh
you could then use s.to.rast and visualize the count number of points for
each cell. The density is: count/(x_step*y_step)
For what you need, I would approach a simple cycle (if you don't have
millions of points, it won't take much time...)
bye,
RafDouglas CTC
___________________________________________
Dott. Ing. RafDouglas Candidi Tommasi Crudeli
ct at ehleng com
___________________________________________
More information about the grass-user
mailing list