[GRASS-user] grass vector model, cats and layers concept

Nikos Alexandris nik at nikosalexandris.net
Tue Jun 4 15:08:54 PDT 2013


[..]


Nikos A:

> > Also, there is a single reference on (how to create a new?) vector
> > attribute table layer(s) in the "Intro: "Using v.db.connect 
> > connections between layers and attribute tables can be listed or
> > maintained.".

Markus N:

> ... I don't fully understand where to add what...

Maybe I was wrong -- perhaps it is better to add a clear instructive example 
in the "v.db.connect" manual itself (where, also, nothing is mentioned 
regarding new layers).

> > Maybe we can add in the manual of "v.db.connect" the word "layer" as a
> > Keyword

> Yes, done so:
> http://grass.osgeo.org/grass70/manuals/keywords.html

> Layer
>     v.category, v.db.connect
 
> > and an example on how to create/connect to a *new* (empty) layer?
 
> Could you provide one for me to add it?

It works (also) for example by

# check existing connections first
v.db.connect -p wrs2_tiles_of_interest_testing

Vector map <wrs2_tiles_of_interest_testing> is connected by:
layer <1/wrs2_tiles_of_interest_testing> table 
<wrs2_tiles_of_interest_testing> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>

# add new layer by... !
v.db.addtable wrs2_tiles_of_interest_testing layer=2

# confirm
v.db.connect -p wrs2_tiles_of_interest_testing layer=2

Vector map <wrs2_tiles_of_interest_testing> is connected by:
layer <1/wrs2_tiles_of_interest_testing> table 
<wrs2_tiles_of_interest_testing> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>
layer <2/wrs2_tiles_of_interest_testing_2> table 
<wrs2_tiles_of_interest_testing_2> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>



The other way, using "v.db.connect" (in G7) gives me the WARNING(s):

v.db.connect wrs2_tiles_of_interest_testing driver=sqlite 
database=/geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db 
table=wrs2_tiles_of_interest_testing_3 key=cat layer=3
WARNING: Table <wrs2_tiles_of_interest_testing_3> does not exist in
         database </geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db>
The table <wrs2_tiles_of_interest_testing_3> is now part of vector map
<wrs2_tiles_of_interest_testing> and may be deleted or overwritten by GRASS
modules
DBMI-SQLite driver error:
Unable to create index:
create unique index wrs2_tiles_of_interest_testing_3_cat on 
wrs2_tiles_of_interest_testing_3 ( cat )
no such table: main.wrs2_tiles_of_interest_testing_3

DBMI-SQLite driver error:
Unable to create index:
create unique index wrs2_tiles_of_interest_testing_3_cat on 
wrs2_tiles_of_interest_testing_3 ( cat )
no such table: main.wrs2_tiles_of_interest_testing_3

WARNING: Cannot create index
Select privileges were granted on the table

Though, it creates the layer=3:

v.db.connect -p wrs2_tiles_of_interest_testing
Vector map <wrs2_tiles_of_interest_testing> is connected by:
layer <1/wrs2_tiles_of_interest_testing> table 
<wrs2_tiles_of_interest_testing> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>
layer <2/wrs2_tiles_of_interest_testing_2> table 
<wrs2_tiles_of_interest_testing_2> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>
layer <3/wrs2_tiles_of_interest_testing_3> table 
<wrs2_tiles_of_interest_testing_3> in database 
</geo/grassdb/global/mangroves/wgs84/PERMANENT/sqlite.db> through driver 
<sqlite> with key <cat>

Oh, yes, I forget... better with NC Spearfish data, right?

Thanks, N


More information about the grass-user mailing list