Opened 9 years ago

Closed 5 years ago

#2641 closed defect (wontfix)

Copy cat value to a new layer does not work

Reported by: pvanbosgeo Owned by: grass-dev@…
Priority: normal Milestone: 7.0.7
Component: Vector Version: unspecified
Keywords: attribute Cc:
CPU: Unspecified Platform: Unspecified

Description

I have a vector map with layer=1 linked to attribute table and layer=2 providing the number of overlapping categories. Aim is to create a third layer with unique values for each feature/polygon. The third step below, uploading the cat values from layer 2 to layer 3 doesn't work.

# Add layer 3 to the vector layer test

# add attribute table v.category test op=add layer=3 type=centroid out=test2 v.db.addtable test2 layer=3 column="cat2 integer"

# Upload cat from layer 2 to layer 3 v.to.db test2 layer=3 query_layer=2 op=cat columns=cat2

Error message:

... WARNING: Record (cat 75456) already exists (not inserted) WARNING: Record (cat 75457) already exists (not inserted) WARNING: Record (cat 75458) already exists (not inserted) WARNING: Record (cat 75459) already exists (not inserted) WARNING: Record (cat 75460) already exists (not inserted)

100%

75460 categories read from vector map (layer 3) 75460 records selected from table (layer 2) 75460 categories read from vector map exist in selection from table 0 records updated/inserted (layer 3)

Change History (11)

comment:1 by neteler, 9 years ago

Milestone: 7.0.17.0.2

Ticket retargeted after 7.0.1 milestone closed

comment:2 by neteler, 8 years ago

Milestone: 7.0.27.0.3

Ticket retargeted after milestone closed

comment:3 by neteler, 8 years ago

This is hard to assess without test data...

comment:4 by neteler, 8 years ago

Component: DefaultVector
Keywords: attribute added

in reply to:  description comment:5 by mlennert, 8 years ago

Replying to pvanbosgeo:

I have a vector map with layer=1 linked to attribute table and layer=2 providing the number of overlapping categories. Aim is to create a third layer with unique values for each feature/polygon. The third step below, uploading the cat values from layer 2 to layer 3 doesn't work.

# Add layer 3 to the vector layer test

# add attribute table v.category test op=add layer=3 type=centroid out=test2 v.db.addtable test2 layer=3 column="cat2 integer"

# Upload cat from layer 2 to layer 3 v.to.db test2 layer=3 query_layer=2 op=cat columns=cat2

AFAIK query_layer is only used for op=query (and op=sides), but not for op=cat.

Currently, if you need to get the cats of another layer, you have to create an attribute table linked to that layer and the use op=query to get the cat values, although I don't know what will happen with a layer 2 as yours where some features have several cat values...

BTW, I tried to test the case where you want to upload cat values to a new column (not the key column) to see how v.to.db handles uploading several cat values for a single feature, but v.to.db chokes on that since before uploading cat values it tests whether these value already exist in the key column of the database, even if you want to upload these values to another column than the key column... But that should probably be documented in another bug report.

In brief, I wouldn't consider this a bug (or at most a documentation bug), as uploading cat values into one column in the case where a feature might have several values is not clearly defined...

comment:6 by neteler, 8 years ago

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:7 by neteler, 8 years ago

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:8 by martinl, 8 years ago

Milestone: 7.0.47.0.5

comment:9 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:10 by neteler, 6 years ago

Milestone: 7.0.67.0.7

comment:11 by martinl, 5 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.