[GRASSLIST:9995] Re: Problem using v.to.db - option cat

Radim Blazek radim.blazek at gmail.com
Wed Jan 25 05:23:33 EST 2006


On 1/24/06, René Capell <rene.ca at web.de> wrote:
> Hi Wolfgang,
>
> actually I am a little bit confused, because i thought categories MUST
> be unique (I=beginner), but if I understood your problem right,
> v.category should do it:
>
> v.category in=stream option=del
> v.category in=stream option=add step=1

Categories does not have to be unique. More elements in map can be linked
to single database row. This is similar to multi* features in simple features.

In this particular cas the category in streams probably have some meaning.
Suggested v.category del/add will work but the information is lost.
If you want a single row for each line you can assign new cats in a new layer
  v.category in=stream output=stream2 layer=2
and create and connect 2 tables:
  echo "create table stream2_1 (cat int)" | db.execute
  echo "create table stream2 _2 (cat int, cat_orig int)" | db.execute
  db.connect map=stream2 layer=1 table=stream2_1
  db.connect map=stream2 layer=2 table=stream2_2
  v.to.db map=stream2 layer=1 option=cat
  v.to.db map=stream2 layer=2 option=cat
and upload original categories to stream2 _2
  v.to.db map=stream2 qlayer=1 layer=2 option=query qcol=cat col=cat_orig

Now you have in the layer 2 unique categories and values of original categories
are uploaded to the attribute table of layer 2.

Radim

> Greets, Rene
>
> >Hi list,
> >I tried to assign unique cat-values to a vector (copy of streams at PERMANENT,
> >spearfish dataset)file using v.to.db. I expected each row to get a unique
> >cat-value (1,2,3 ...), but received a different result: in total I have
> >three different values for cat (1,2 and 3 like 1,1,1,2,2,2,2,2,3,3,2,2,2,1).
> >How can I assign unique cat-values?
> >
> >Greetings,
> >
> >Wolfgang
> >
> >
> >
> >
>
>




More information about the grass-user mailing list