Hi,

any comments re. the following patch?

it lets you use v.what.rast for centroids as well as points.

I have made a (100m) buffer around a number of points, and in addition to
the raster stats for the buffer provided by v.rast.stats I want to know
the exact value at the center point (field sampling station). In this
case my centroid is exactly in the middle of the area so it's ok. I'm not
so sure that this patch is useful when the centroid is randomly placed
within the area, hence this email. Then again the result is actually
uploaded to the centroid, not the area, so maybe all-correct just
sometimes requires a grain of salt in the interpretation.

???


Another issue touched by a recent thread* re. bounding boxes of features
within a vector map: v.rast.stats is VERY slow. This is because it creates
a r.mapcalc MASK at the full raster region resolution for each cat it
processes. When picking out small vector buffers from a large raster this
is highly inefficient. It would be much better to find the bounding box
of each selected vector cat, zoom in on it with the GRASS_REGION or
WIND_OVERRIDE enviro variables for the duration of the r.mapcalc and
r.univar calls for each cat.

[*] http://thread.gmane.org/gmane.comp.gis.grass.user/20327

I would be cool to have a C module which could do 'v.info -g' bounds for
cats=1,3,5-9,13 &/or where='SQL query'.  ??


Hamish

ps- r.category label setting updates are mostly done, it just needs some
cleaning. I expect it will need more testing and debugging than most
changes as the labeling lib fns are very dusty.
Index: main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/vector/v.what.rast/main.c,v
retrieving revision 1.25
diff -u -r1.25 main.c
--- main.c	3 Oct 2007 14:29:21 -0000	1.25
+++ main.c	9 Oct 2007 12:16:07 -0000
@@ -154,7 +154,7 @@
 	G_warning ( _("Raster type is float and column type is integer, some data lost!!") );
 	     
     /* Read vector points to cache */
-    Cache_size = Vect_get_num_primitives ( &Map, GV_POINT ); 
+    Cache_size = Vect_get_num_primitives ( &Map, GV_POINTS );
         /* Note: Some space may be wasted (outside region or no category) */
 
     cache = (struct order *) G_calloc ( Cache_size, sizeof (struct order) );
@@ -168,7 +168,7 @@
 	G_debug ( 4, "line = %d type = %d", i, type );
 
         /* check type */
-	if ( !(type & GV_POINT) ) continue; /* Points only */
+	if ( !(type & GV_POINTS) ) continue; /* Points and Centroids only */
 
 	/* check region */
 	if ( ! Vect_point_in_box ( Points->x[0], Points->y[0], 0.0, &box) ) {
_______________________________________________
grass-dev mailing list
[email protected]
http://grass.itc.it/mailman/listinfo/grass-dev

Reply via email to