[GRASS-dev] v.to.db problems if layer > 1
Markus Neteler
neteler at osgeo.org
Thu Nov 27 03:36:05 EST 2008
On Thu, Nov 27, 2008 at 12:10 AM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 26/11/08 11:34, Markus Neteler wrote:
>>
>> I try to use v.db.addtable with a second layer but v.to.db apparently
>> fails
>> (called by v.db.addtable):
>>
>> # Spearfish
>> g.copy vect=roads,myroads --o
>> v.info -c myroads
>> v.db.addtable myroads table=extratab layer=2 columns="cat
>> integer,label varchar(100)"
>> ...
>> Updating database...
>> 100%
>> 1 categories read from map <- BAD should be 6
>
> Why, roads has no features in layer two, so just by copying it and adding a
> new table to another layer, you do not add new categories in that layer. You
> would need 'v.category option=add layer=2' for that.
Well, I though v.db.addtable would take care of doing the v.category job for
me (see script).
>> ...
>> v.db.select myroads layer=2
>> cat|label
>> <- empty, should have 6 cats
>>
>> # compare layer1:
>> v.db.select myroads layer=1
>> cat|label
>> 0|no data
>> 1|interstate
>> 2|primary highway, hard surface
>> 3|secondary highway, hard surface
>> 4|light-duty road, improved surface
>> 5|unimproved road
>>
>> -----------
>> # calling directly v.to.db
>> v.to.db myroads layer=2 option=cat col=cat qlayer=1
>
> Shouldn't this be:
>
> v.to.db myroads layer=2 option=query col=cat qlayer=1 qcolumn=cat
Ah, yes, sounds good.
Still I feel that v.db.addtable should add the cats.
Markus
More information about the grass-dev
mailing list