[GRASS-dev] more help with v.category...

Hello list. I am continuing to struggle with update/manipulation of vector categories between the dbf and vector file. Perhaps if I state what I am trying to do, someone can help me out. I am using latest wingrass 6.4 binary on XP.

I have some vector points file created by v.mkgrid where the points are regularly spaced at various grid intervals and orientations. I have used v.buffer to make a new vector file from these points where there are small circular buffers around each point. I have a few base vector points maps that I genertated using several tools (including v.random, v.perturb, and others) where there are clusters of points at varying densities across the region. These base maps are to simulate the spread of small pieces of refuse on an archaeological site, and the grids of circular buffers represent different sampling strategies. The idea is to be able to count the number of objects within each sample circle and use that to interpolate a density surface (first change the random points base map to raster and then use v.rast.stats with the sample circles map so that count will be in column “n”). The resulting density surfaces will be compared with the real point density map to see which sampling strategy works best.

My main problem at the moment is that I need to have a row for each sampling point/circle in the dbf of the sampling maps. The points in the points maps made by v.mkgrid each have their own cat number. After running v.buffer to make circular areas around each point, all circular areas have cat=1. Each circle has it’s own unique feature ID, but all have category = 1. I know I should to be able to make each vector object have it’s own unique category number. Then I could run v.to.db and update the cat column in the dbf with these unique cats, and I would be good to go forward from this step. But I can’t get the circles to have unique cats!!! I’ve run v.category in every way imaginable, but I cannot get it to do what I want! It continues to produce new maps where all the vector points or centroids all share the SAME cat number! I’ll post the output of v.category below. If v.category doesn’t work to do this then how can I get sequential cat numbers? This seems like such a simple simple thing. Shouldn’t be possible to somehow just read the feature ID’s into the category for each object? Please let me know if I’m doing something wrong, or let me know if GRASS just can’t do this.

Okay, here is the output of v.category. First report existing cat numbers:

v.category input=tril_lattice_1m_eq_5cm_RAD_CIRCS@1m_trilattice option=report type=centroid
Layer/table: 1/tril_lattice_1m_eq_5cm_RAD_CIRCS
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 159 1 1
area 0 0 0
all 159 1 1

See: all have category = 1. Okay now try to overwrite cats following the logic from the man page (“If the type parameter is set to centroid and the option parameter set to add, new categories will be added to existing centroids.”). So I do this:

v.category --overwrite input=tril_lattice_1m_eq_5cm_RAD_CIRCS@1m_trilattice output=tril_lattice_1m_eq_5cm_RAD_CIRCS_cats_added@1m_trilattice type=centroid
Vector map <tril_lattice_1m_eq_5cm_RAD_CIRCS_cats_added> already exists and will be overwritten
Processing features…
Copying attribute table(s)…
Building topology for vector map <tril_lattice_1m_eq_5cm_RAD_CIRCS_cats_added>…
Registering primitives…
318 primitives registered
3975 vertices registered
Building areas…
159 areas built
159 isles built
Attaching islands…
Attaching centroids…
Number of nodes: 318
Number of primitives: 318
Number of points: 0
Number of lines: 0
Number of boundaries: 159
Number of centroids: 159
Number of areas: 159
Number of isles: 159
v.category complete. 0 features modified.

It does nothing. I emboldened where it says “0 features modified”. To be sure, I run report on the new vector map:

v.category input=tril_lattice_1m_eq_5cm_RAD_CIRCS_cats_added@1m_trilattice option=report type=centroid
Layer/table: 1/tril_lattice_1m_eq_5cm_RAD_CIRCS_cats_added
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 159 1 1
area 0 0 0
all 159 1 1

See. It keeps all category = 1!

So, how can I make all 159 individual areas have unique category numbers?!?!?

PS. As an aside, now that I have for the first time really started to work with the vector tools in GRASS, I am noticing that they are very very confusing to use. The documentation is a bit sparse, and the interfaces don’t make much intuitive sense. And it is very difficult to do simple things like make an attribute table with rows for each vector object. These kinds of basic operations take multiple steps and sometimes I just can’t make them work…

Cheers,

Isaac


Isaac I Ullah, M.A.

Archaeology PhD Candidate,
ASU School of Evolution and Social Change

Research Assistant,
Mediterranean Landscape Dynamics Project


isaac.ullah@asu.edu
ullah@archaeologist.com

http://www.public.asu.edu/~iullah


Isaac Ullah wrote:

[...]

So, how can I make all 159 individual areas have unique category numbers?!?!?

I think you have to delete all categories first, because v.category will only add a category to a vector object if none is set (that information is missing in the manual AFAICT). Or you add categories to a new layer.

Markus M