[GRASS-user] Site in Polygon Query

Jarosław Jasiewicz jarekj at amu.edu.pl
Wed May 23 07:55:59 EDT 2007


Martin Wegmann napisał(a):

>Hello Michael,
>
>On Wednesday, 23. May 2007 12:29:41 Michael Malicky wrote:
>  
>
>>Dear All!
>>
>>I am using GRASS for some time now, mainly for plotting distribution maps
>>of plants and animals. Now a user came up with a different request:
>>We have a map consisting of polygons and another one with sites. We need a
>>query to filter all polygons that include at least one site. Is there a
>>special command for this or a script ? Any help is welcome.
>>    
>>
>
>just an idea:
>
>v.to.rast of polygons and sites (use=val)
>
>r.statistics method=sum 
>and then 
>r.mapcalc "output = if(map_sum > 1,1,null())"
>
>regards, Martin
>
>
>  
>
Another simple idea

v.to.rast of polygons with unique cats as raster value
add column to points vector named 'poly_col'
v.what.rast on new raster

echo "count(*), poly_col, FROM your_point_table_name GROUP BY poly_col" |db.execute

that all.

Jarek





More information about the grass-user mailing list