[GRASS-user] points in polygon query

Stefano Costa steko at iosa.it
Mon May 21 03:34:01 EDT 2007


Il giorno sab, 19/05/2007 alle 15.31 +0200, Stefano Costa ha scritto:
> 
> Last night I wrote this script that does the job. Quite slow, but
> works.
> http://grass.gdf-hannover.de/wiki/V.count.points

Some more words on that (Saturday I was at an internet point), just
because it was actually me who asked Markus about this feature.

This is a shell script that calls v.what.vect to know which points fall
into each area. Counts for each area are written to a new column
"count". This attribute can be used as input for d.vect.chart (bar
chart).
You can you also provide a column name for the points vector, that
contains a classification attribute. This way more columns are created,
to be used for creating pie-charts. When you use pie-charts, the "count"
column can be used to generate different sizes of graphics proportional
to the total number of points in each area.

As I previously wrote, this script is very slow, because it uses a
nested for loop, so if you have 10000 points and 1000 areas, it calls
10000 * 1000 database queries (in case you provide a class column). This
is very inefficient. If someone with enough skills (not me) wants to
write a better module, I think significant parts of code from v.qcount
can be useful. It would be good to have such a feature included by
default in GRASS, with an efficient and fast code.

Soon I'll move the script to the Quantitative Archaeology Wiki
http://wiki.iosa.it/ into a series of tutorials on Spatial Analysis.

Thanks,
Stefano

-- 
Stefano Costa
steko at jabber.linux.it
http://www.iosa.it Archeologia e Software Libero
Io uso Debian GNU/Linux!




More information about the grass-user mailing list