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.
sincerely yours
Michael
DI Michael Malicky
EDV Leiter
Oberösterreichische Landesmuseen/Biologiezentrum
Johann-Wilhelm-Klein Str. 73
A-4040 Linz
Österreich
Tel.: +43/732/759733-33
FAX.: +43/732/759733-99
Mobil: +43/664/60072/52333
E-Mail: m.malicky@landesmuseum.at
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
sincerely yours
Michael
DI Michael Malicky
EDV Leiter
Oberösterreichische Landesmuseen/Biologiezentrum
Johann-Wilhelm-Klein Str. 73
A-4040 Linz
Österreich
Tel.: +43/732/759733-33
FAX.: +43/732/759733-99
Mobil: +43/664/60072/52333
E-Mail: m.malicky@landesmuseum.at
DLR - German Aerospace Center
German Remote Sensing Data Center
@
Dept.of Geography
Remote Sensing and Biodiversity Unit
University of Wuerzburg
Am Hubland
97074 Würzburg
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
Il giorno mer, 23/05/2007 alle 12.29 +0200, Michael Malicky ha scritto:
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 ?
With a few adjustments it should work also for you (in fact, this script
does more than you need because it also counts how many points are
included in each polygon).
HTH, Steko
--
Stefano Costa
steko@jabber.linux.it http://www.iosa.it Archeologia e Software Libero
Io uso Debian GNU/Linux!
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
is not v.select the right command?
As I use it just today with ain=[polygon file] and bin=[point file] it selects just the polygons where I find the points...
Manuel
--
Dr. Manuel Seeger
Wiss. Assistent Scientific Assistant
Physische Geographie Dpt. of Physical Geography
FB VI - Geographie/Geowissenschaften Geography/Geosciences
Universität Trier University of Trier
D - 54286 Trier
Tel.: +49-651-201 4557
Fax: +49-651-201 3976
Web: http://www.uni-trier.de/uni/fb6/geographie/mitarbeiter/Seeger/
With a few adjustments it should work also for you (in fact, this
script does more than you need because it also counts how many points
are included in each polygon).
idea: add a flag to optionally divide the number of points by the
polygon's area, so you get site density. Lots of points in a polygon may
just mean that the polygon is big. (just looking at your screenshots)
(get polygon area from v.to.db; results DOUBLE PREC)