[GRASS-dev] About v.distance, v.what.vect (wrt "count points
within...").
Moritz Lennert
mlennert at club.worldonline.be
Fri Aug 13 04:25:27 EDT 2010
On 12/08/10 16:51, Markus Metz wrote:
> Start from scratch:
>
> I've put a new module in grass-addons, called v.vect.stats. It counts
> points in polygons, fairly fast, but, as the name implies, can do a
> bit more. Optionally, it calculates statistics for areas based on the
> attributes of all points falling into an area. Currently supported
> methods are sum, average, median, mode, min, min_cat, max, max_cat,
> range, stddev, variance, diversity. The meaning of min_cat and max_cat
> is the category value corresponding to the observed minimum/maximum
> value, e.g. the hospital with the largest number of beds and not the
> largest number of beds.
>
> The module is meant as the companion to v.rast.stats, update area
> attributes from raster: v.vect.stats, update area attributes from
> vector
>
> Have fun,
>
> Markus M
>
> PS: No entry on wiki because I am not sure what will happen with the
> module. If it's regarded nonsense, it will be removed again. OTOH, it
> might end up in trunk.
No nonsense in my eyes. Very nice and useful little module.
In terms of usage time, the parts that take most time with large files
(the 600,000 points and 100x100 grid used before) are the creation of
the spatial index and (if a stats method is applied) the collecting of
attributes from the points vector (at one point we will probably have to
attack db driver efficiency issues in GRASS... example: do we really
have to create a select cursor and loop through every line this returns
?). The actual point-in-areas is very fast !
A few small questions/remarks:
- Any special reason why you construct a whole SQL statement to add the
columns, instead of using db_add_column() (defined in
lib/db/dbmi_client/c_add_col.c) ?
- Maybe add a key to point_column_opt to call it point_column (instead
of the default "column")
- If one sets a method and a stats_column, but no point_column, the
first two settings are simply ignored. Maybe a fatal error would be
better (I took me a bit of time to understand that I had forgotten the
point_column.
No time for more, but I really think this would be a useful addition to
trunk...
Moritz
More information about the grass-dev
mailing list