[GRASS-user] why v.patch -e produces cat column starting from 2?

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Wed Nov 12 08:44:43 EST 2008


On Wed, 2008-11-12 at 05:35 +0100, Nikos Alexandris wrote:
> Why isn't the cat column starting from 1 after (v.)patching vector maps
> (whose cat's start normally from 1)? Is it that my maps have somethig
> wrong? Is there a specific reason?

(Following up with a long example)

I don't understand how v.patch and v.category work. Probably I
misunderstand v.category. I kindly request for some assistance to
clear-up my confusion.

Regards, Nikos

Help pages state:

1. v,patch -e
Copy also attribute table
Only the table of layer 1 is currently supported

Question: Does this have anything to do with the cat starting from 2 in
my example below?

2. v.category option=del
"v.category attaches, deletes or reports vector categories to map
geometry. These categories (IDs) are used to link geometry object(s) to
attribute record (from attribute table linked to vector map)."

del: delete category

Question: Do the v.category options have any "obvious" effect, i.e.
something that the end-user can see in the attribute table?



# two imported shapefiles far away from each other (no overlaps)

# 1rst vector map: daun_test

# info of 1st map
v.info -t daun_test

nodes=143
points=0
lines=0
boundaries=142
centroids=62
areas=62
islands=1
faces=0
kernels=0
primitives=204

## head of daun_test
db.select daun_test | head -5

cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
1|2592_5562|daun|2005|3
2|2594_5562|daun|2005|3
3|2584_5560|daun|2005|3
4|2586_5560|daun|2005|3

## tail of daun_test
db.select daun_test | tail -5

58|2578_5540|daun|2005|3
59|2580_5540|daun|2005|3
60|2582_5540|daun|2005|3
61|2584_5540|daun|2005|3
62|2586_5540|daun|2005|3

# 2nd vector map: trier_test

# topology of 2nd map
v.info -t trier_test

nodes=240
points=0
lines=0
boundaries=239
centroids=110
areas=110
islands=1
faces=0
kernels=0
primitives=349

## head of trier_test
db.select trier_test | head -5

cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
1|2558_5524|trier|2005|1
2|2552_5522|trier|2005|1
3|2556_5522|trier|2005|1
4|2558_5522|trier|2005|1

## tail of trier_test
db.select trier_test | tail -5

106|2538_5492|trier|2005|1
107|2540_5492|trier|2005|1
108|2542_5492|trier|2005|1
109|2538_5490|trier|2005|1
110|2540_5490|trier|2005|1

# patching test1 with "-e" flag
v.patch -e input=daun_test,trier_test out=patching_test1

Patching vector map <daun_test at PERMANENT>...
Patching vector map <trier_test at PERMANENT>...
Building topology for vector map <patching_test1>...
553 primitives registered            
954 vertices registered
Building areas:  100%
172 areas built      
2 isles built
Attaching islands:  100%
Attaching centroids:  100%
Topology was built
Number of nodes     :   383
Number of primitives:   553
Number of points    :   0
Number of lines     :   0
Number of boundaries:   381
Number of centroids :   172
Number of areas     :   172
Number of isles     :   2
Intersections at borders will have to be snapped
Lines common between files will have to be edited
The header information also may have to be edited
v.patch complete. 2 vector maps patched

# cat of patched map starts with 2
db.select patching_test1 | head -5
cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
2|2592_5562|daun|2005|3
3|2594_5562|daun|2005|3
4|2584_5560|daun|2005|3
5|2586_5560|daun|2005|3

### Why not with 1??

# simple patching: works fine but, as expected, does not keep attribute
tables
v.patch input=daun_test,trier_test out=patching_test2

Patching vector map <daun_test at PERMANENT>...
Patching vector map <trier_test at PERMANENT>...
Building topology for vector map <patching_test2>...
553 primitives registered            
954 vertices registered
Building areas:  100%
172 areas built      
2 isles built
Attaching islands:  100%
Attaching centroids:  100%
Topology was built
Number of nodes     :   383
Number of primitives:   553
Number of points    :   0
Number of lines     :   0
Number of boundaries:   381
Number of centroids :   172
Number of areas     :   172
Number of isles     :   2
Intersections at borders will have to be snapped
Lines common between files will have to be edited
The header information also may have to be edited
v.patch complete. 2 vector maps patched

# head of test2
db.select patching_test2 | head -5

cat
1
2
3
4

an EXTRA question:

# v.category option=report
v.category patching_test1 option=report

Layer/table: 1/patching_test1
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid     172          2        174
area           0          0          0
all          172          2        174

# "v.category option=del" dos not remove categories in attribute table
# Question: Is this right or wrong?

db.select patching_test1_DELETED | head -5

cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
2|2592_5562|daun|2005|3
3|2594_5562|daun|2005|3
4|2584_5560|daun|2005|3
5|2586_5560|daun|2005|3

# v.category option=report
v.category input=patching_test1_DELETED option=report
## no output for patching_test1_DELETED. I suppose this is correct

# or
v.category patching_test1 out=patching_test1_DELETED2 option=del cat=2

# gives the same attribute table output!?
db.select patching_test1_DELETED2 | head -5

cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
2|2592_5562|daun|2005|3
3|2594_5562|daun|2005|3
4|2584_5560|daun|2005|3
5|2586_5560|daun|2005|3

# and report
v.category input=patching_test1_DELETED2 option=report
## gives nothing, same as with patching_test1_DELETED above

# or
v.category patching_test1 out=patching_test1_DELETED3 option=del id=3

# again the same output!?
db.select patching_test1_DELETED2 | head -5
cat|RAS2X2_NR|BLOCK|BEFL_JAHR|block_id
2|2592_5562|daun|2005|3
3|2594_5562|daun|2005|3
4|2584_5560|daun|2005|3
5|2586_5560|daun|2005|3
## should this be the expected output here?

# report on DELETED3 gives something which is identical with the
"original" vector!?
## What is the option "id" doing exactly?

v.category input=patching_test1_DELETED3 option=report

Layer/table: 1/patching_test1_DELETED3
type       count        min        max
point          0          0          0
line           0          0          0
boundary       0          0          0
centroid     172          2        174
area           0          0          0
all          172          2        174



More information about the grass-user mailing list