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

Hi list,
I tried to assign unique cat-values to a vector (copy of streams@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

--
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl

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

Greets, Rene

Hi list,
I tried to assign unique cat-values to a vector (copy of streams@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

Hi Rene,
thanks for this hint. Works fine (one needs to specify the output file)!

so I did:
v.category in=stream out=stream_tmpd option=del
v.category in=stream_tmpd out=stream_newcat option=add
#delete temp data.

Cheers,

Wolfgang

--8<--------------------

Greets, Rene

>Hi list,
>I tried to assign unique cat-values to a vector (copy of
streams@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
>
>
>
>

--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

On 1/24/06, René Capell <rene.ca@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@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
>
>
>
>

Hi Radim,
thank you very much for your reply. I tried to apply this to another issue - a
polygon buffer theme with a donut polygon [1]. However, the solution
described by you also creates another centroid within the "hole" of the
polygon. Any ideas?

Best regards,

Wolfgang

[1] http://grass.itc.it/pipermail/grassuser/2006-January/032130.html

--8<------------------------------------------------------------------------------------------------
Am Mittwoch 25 Januar 2006 pH:23:11 vormittags schrieb Radim Blazek:

On 1/24/06, René Capell <rene.ca@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@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

Dear list, Radim, René -
regarding the donut polygon-problem:
it came to me that I can delete the centroid within the hole of the donut
using v.digit.
However, this "solution" is not feasible for themes with lots of "donuts" (for
example a street network).
Therefore, I am still looking for a possibility to assign (automatically)
unique cat-values to a (buffer) theme that contains donuts without assigning
cat values to the holes of the theme.

I greatly appreciate your ideas!

Best regards,

Wolfgang

----------
Am Freitag 27 Januar 2006 pH:48:12 nachmittags/abends schrieb wqual:

Hi Radim,
thank you very much for your reply. I tried to apply this to another issue
- a polygon buffer theme with a donut polygon [1]. However, the solution
described by you also creates another centroid within the "hole" of the
polygon. Any ideas?

Best regards,

Wolfgang

[1] http://grass.itc.it/pipermail/grassuser/2006-January/032130.html

--8<-----------------------------------------------------------------------
-------------------------

Am Mittwoch 25 Januar 2006 pH:23:11 vormittags schrieb Radim Blazek:
> On 1/24/06, René Capell <rene.ca@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@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