[GRASS-user] points in polygon query

Moritz Lennert mlennert at club.worldonline.be
Mon May 21 04:10:04 EDT 2007

On 21/05/07 09:39, Hamish wrote:
> Stefano Costa wrote:
>> for i in $areas; do
>>    count=$( db.select -c points_tmp sql="select cat_area from points_tmp" | grep -c $i)
> You might want to make the ending "grep -c $i" a bit more specific,
> as you don't want to count "10,11,Site 1" in a where="cat = 1" grep count.
> As written it could lead to buggy results.

Can't you do the selection directly in sql:

count=`db.select -c points_tmp sql="select count(*) from points_tmp 
where cat_area=$i"`

  (but no idea if this is faster)


More information about the grass-user mailing list