[GRASS-user] v.centroids and cat values

Micha Silver micha at arava.co.il
Sat Jan 3 11:29:49 EST 2009


I'd like to better understand the way cat values are assigned to 
centroids when using v.centroids. I came across a problem when I created 
a new vector and digitized boundaries (v.digit -n) .  Before beginning 
to digitize, I added some columns to the attribute table within v.digit, 
so that on completing each feature, I could fill in the values for that 
feature. I had one column for the label, and one column, GRASSRGB for 
coloring. I did not bother to digitize centroids, but rather, after 
completing the boundaries, and exiting v.digit, I ran v.centroids.

I was surprised to see that the cat value assigned to each centroid 
*does not correspond* to the cat values of the surrounding boundary. 
This has the unfortunate effect of showing incorrect labels when running 
d.vect with the display=shape,attr option, since the attribute is taken 
from centroid, and not from its surrounding boundary. In addition, when 
coloring with the d.vect -a option, the boundaries get the correct color 
from the GRASSRGB column, but the fill color is also wrong, since the 
fill color is again taken from the attributes of the centroid. And the 
centroid, with a different cat value, goes to the wrong row of the 
attached attribute table.  This behavior is certainly undesirable, 
unless I'm missing something basic??

My workaround was to delete all centroids, then go back into v.digit, 
and digitize each centroid, while being careful to choose it's cat value 
manually, and set each one to the correct cat of the surrounding 
boundary by choosing "Manual Entry" instead of "Next not used" mode for 
categories.

So, is there some way to create centroids, such that they automatically 
get the same cat value as the boundary?


Thanks,

Micha




More information about the grass-user mailing list