[GRASS-user] tables connection in database

Dear List,

I have some problems with tables stored in PostgreSQL database.
I'm using openSUSE 11.1 (and 10.3), PostgreSQL 8.2.13 and GRASS GIS 6.4.0RC4
My default db connection for my mapsets is set to postgresql.
I am using schemas within the database corresponding to the mapsets. So
my mapset "forest" has a corresponding schema "forest" in the database
where all the forest-tables should be stored.

Problem 1:
After dissolving with v.extract -d using the new= parameter I tried to
use v.db.addtable to create a table for my dissolved map. This has to be
done, as far as I understood, since the new= parameter of v.extract
results in maps without tables.
Now v.db.addtable creates the table, but doesn't put it in the right
database schema. It is created in the schema "public2 and not in the
schema 2forest", where it should be. Although db.connect -p verifys that
all connection parameters are correctly set.
I guess using v.extract without dissolving and doing that later using
v.dissolve will solve the problem. I was just wondering if anyone
experienced the same issues with the schemas and if there is a solution
to this.

Problem 2:
This is really confusing me. I tried to use the capability of linking
more than one attribute table to a map. Overall I succeded doing so.
Grass reports (in german):

...................................................................................
v.db.connect -o map=trees_geo_init key=cat_id layer=3
table=forest.trees_buche

Die Tabelle <forest.trees_buche> ist jetzt Teil der Vektorkarte
<trees_geo_init> und kann mit GRASS Modulen gelöscht und überschrieben
werden.
Select-Privilegien wurden für die Tabelle gewährt.
....................................................................................
Something like: "The table forest.trees_buche is now connected to the
map trees_geo_init and can be used..."

The connection seems to be established.
I didn't succeed, however, in exporting the map to a shapefile using the
information of layer 3 (as created above):
v.out.ogr input=trees_geo_init_buche layer=3 dsn=/home/fengel/tmp

Also v.extract can't use the new layer:
v.extract input=trees_geo_init output=trees_geo_init_buche layer=3
This results in empty maps.

Also I cannot get QGIS to use the information from this layer, although
QGIS explicitly offers the option to choose the layer when opening a
grass-mapset vector layer.

I would be thankful if anyone could help.

Cheers, Falko

On 23/06/09 17:42, Falko Engel wrote:

Dear List,

I have some problems with tables stored in PostgreSQL database.
I'm using openSUSE 11.1 (and 10.3), PostgreSQL 8.2.13 and GRASS GIS 6.4.0RC4
My default db connection for my mapsets is set to postgresql.
I am using schemas within the database corresponding to the mapsets. So
my mapset "forest" has a corresponding schema "forest" in the database
where all the forest-tables should be stored.

Problem 1:
After dissolving with v.extract -d using the new= parameter I tried to
use v.db.addtable to create a table for my dissolved map. This has to be
done, as far as I understood, since the new= parameter of v.extract
results in maps without tables.
Now v.db.addtable creates the table, but doesn't put it in the right
database schema. It is created in the schema "public2 and not in the
schema 2forest", where it should be. Although db.connect -p verifys that
all connection parameters are correctly set.
I guess using v.extract without dissolving and doing that later using
v.dissolve will solve the problem. I was just wondering if anyone
experienced the same issues with the schemas and if there is a solution
to this.

I guess this is a bug in v.db.addtable (which is just a script). It uses:

echo "CREATE TABLE $table ($COLUMN_DEF)" | db.execute database="$database" driver="$driver"

to create the table, and so does not take into account the schema. Should be easy to fix, but no time now. Please post a bug report about this, so that it is not forgotten.

Problem 2:
This is really confusing me. I tried to use the capability of linking
more than one attribute table to a map. Overall I succeded doing so.
Grass reports (in german):

...................................................................................
v.db.connect -o map=trees_geo_init key=cat_id layer=3
table=forest.trees_buche

Just adding a database connection to a layer does not add any features to that layer. In order for features to appear in a specific layer, you have to give them a category value in that layer, i.e. with v.category.

Moritz

Hi all,

I think I am not the only one having problems with getting the connection "vector geometry features" - "attribute table" (for me its a sqlite db at the moment). :wink:

So I wonder how is the default way to deal with vector layers to establish a metadata table to each geometry object?

I always have the problem that the table is empty. And adding category is not enough to add an entry for every geometry object... well.

Achim

On 26/06/09 11:30, achim wrote:

Hi all,

I think I am not the only one having problems with getting the connection "vector geometry features" - "attribute table" (for me its a sqlite db at the moment). :wink:

So I wonder how is the default way to deal with vector layers to establish a metadata table to each geometry object?

Normally, categories are added and a table is automatically created at vector import, or, by default, at digitalisation. But some modules do not create a table as they wouldn't know what to put in it (and a table with just cat values is not very useful as such).

I always have the problem that the table is empty. And adding category is not enough to add an entry for every geometry object... well.

After adding the category, you have to upload it to the table with v.to.db.

If you do not even have a table connected to the map, you can run the script v.db.addtable which creates the table (by running an SQL query) and then adds the category values to it (with v.to.db).

Moritz

Yes, thanks,

but how to force that every single geometry object (of one kind) gets an entry?

Achim

(just to mention: And why aren't those commands reachable in an useful order? One always has to check whether the table are built, go and add a table, on another place set connection, on another place load up cats...alway confusing and lots of clicking in the gui)

Moritz Lennert wrote:

On 26/06/09 11:30, achim wrote:

Hi all,

I think I am not the only one having problems with getting the connection "vector geometry features" - "attribute table" (for me its a sqlite db at the moment). :wink:

So I wonder how is the default way to deal with vector layers to establish a metadata table to each geometry object?

Normally, categories are added and a table is automatically created at vector import, or, by default, at digitalisation. But some modules do not create a table as they wouldn't know what to put in it (and a table with just cat values is not very useful as such).

I always have the problem that the table is empty. And adding category is not enough to add an entry for every geometry object... well.

After adding the category, you have to upload it to the table with v.to.db.

If you do not even have a table connected to the map, you can run the script v.db.addtable which creates the table (by running an SQL query) and then adds the category values to it (with v.to.db).

Moritz

...I mean: how to get an table entry for every vector objects Id? (every geometry object has an unique id)

achim wrote:

Yes, thanks,

but how to force that every single geometry object (of one kind) gets an entry?

Achim

(just to mention: And why aren't those commands reachable in an useful order? One always has to check whether the table are built, go and add a table, on another place set connection, on another place load up cats...alway confusing and lots of clicking in the gui)

Moritz Lennert wrote:

On 26/06/09 11:30, achim wrote:

Hi all,

I think I am not the only one having problems with getting the connection "vector geometry features" - "attribute table" (for me its a sqlite db at the moment). :wink:

So I wonder how is the default way to deal with vector layers to establish a metadata table to each geometry object?

Normally, categories are added and a table is automatically created at vector import, or, by default, at digitalisation. But some modules do not create a table as they wouldn't know what to put in it (and a table with just cat values is not very useful as such).

I always have the problem that the table is empty. And adding category is not enough to add an entry for every geometry object... well.

After adding the category, you have to upload it to the table with v.to.db.

If you do not even have a table connected to the map, you can run the script v.db.addtable which creates the table (by running an SQL query) and then adds the category values to it (with v.to.db).

Moritz

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On 26/06/09 12:10, achim wrote:

Yes, thanks,

but how to force that every single geometry object (of one kind) gets an entry?

It might help if you could tell us exactly what you are trying to do. If I understand your question correctly, you need to make sure that all geometry objects for which you wish to have an entry have a category value:

v.category in=MapWithoutCats option=add out=MapWithCats

Then you have to create a table to hold the attribute values:

echo "create table MapWithCats (cat integer)" | db.execute

which you then connect to your map:

v.db.connect -o MapWithCats table=MapWithCats key=cat

and fill with cat values

v.to.db MapWithCats option=cat column=cat

The three last steps are all done for you by the script module v.db.addtable. The first one is left for you since only you can decided which objects in your map should be included.

Or you can use the new wxpython GUI to quite easily create a new table and connect the map to that table (both in the Manage layers tab).

(just to mention: And why aren't those commands reachable in an useful order?

Define a useful order.

One always has to check whether the table are built, go and add a table, on another place set connection,

In the wxpython GUI these two steps are two clicks in one tab of the table manager.

on another place load up cats...alway confusing and lots of clicking in the gui)

As already mentioned, v.db.addtable (in the GUI: Databases->Manage databases->New table) does all of this for you in one single run.

Maybe you should explain your entire workflow a bit more, and where exactly you encounter difficulties, but I've always found the default settings to work in 95% of cases...

Moritz

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
  | Type of Map: vector (level: 2)

  |

  | Number of points: 0 Number of areas: 0

  | Number of lines: 2326 Number of islands: 0

  | Number of boundaries: 0 Number of faces: 0

  | Number of centroids: 0 Number of kernels: 0

  | Map is 3D: No

  | Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

(with grass65 wx-gui)
v.to.db map=my_lines@achim type=line option=cat
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)

?here no records updated/inserted again
(The "Table Manager" shows no entries as well)

...Seems like there is something wrong up to here.

Achim

PS: Later I try do define a useful order. But first I have to understand..

Moritz Lennert wrote:

On 26/06/09 12:10, achim wrote:

Yes, thanks,

but how to force that every single geometry object (of one kind) gets an entry?

It might help if you could tell us exactly what you are trying to do. If I understand your question correctly, you need to make sure that all geometry objects for which you wish to have an entry have a category value:

v.category in=MapWithoutCats option=add out=MapWithCats

Then you have to create a table to hold the attribute values:

echo "create table MapWithCats (cat integer)" | db.execute

which you then connect to your map:

v.db.connect -o MapWithCats table=MapWithCats key=cat

and fill with cat values

v.to.db MapWithCats option=cat column=cat

The three last steps are all done for you by the script module v.db.addtable. The first one is left for you since only you can decided which objects in your map should be included.

Or you can use the new wxpython GUI to quite easily create a new table and connect the map to that table (both in the Manage layers tab).

(just to mention: And why aren't those commands reachable in an useful order?

Define a useful order.

One always has to check whether the table are built, go and add a table, on another place set connection,

In the wxpython GUI these two steps are two clicks in one tab of the table manager.

on another place load up cats...alway confusing and lots of clicking in the gui)

As already mentioned, v.db.addtable (in the GUI: Databases->Manage databases->New table) does all of this for you in one single run.

Maybe you should explain your entire workflow a bit more, and where exactly you encounter difficulties, but I've always found the default settings to work in 95% of cases...

Moritz

On 26/06/09 15:24, achim wrote:

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
| Type of Map: vector (level: 2)
|
| Number of points: 0 Number of areas: 0
| Number of lines: 2326 Number of islands: 0
| Number of boundaries: 0 Number of faces: 0
| Number of centroids: 0 Number of kernels: 0
| Map is 3D: No
| Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

Probably none of your lines have categories. What does v.category my_lines option=report show ?

Moritz

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

Achim

Moritz Lennert wrote:

On 26/06/09 15:24, achim wrote:

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
| Type of Map: vector (level: 2)
|
| Number of points: 0 Number of areas: 0
| Number of lines: 2326 Number of islands: 0
| Number of boundaries: 0 Number of faces: 0
| Number of centroids: 0 Number of kernels: 0
| Map is 3D: No
| Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

Probably none of your lines have categories. What does v.category my_lines option=report show ?

Moritz

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

Another example where it works partly:
  | Type of Map: vector (level: 2)

  | Number of points: 1 Number of areas: 56

  | Number of lines: 0 Number of islands: 1

  | Number of boundaries: 255 Number of faces: 0

  | Number of centroids: 56 Number of kernels: 0

  |

  | Map is 3D: No

  | Number of dblinks: 1

successfully created a table with 57 entries
?->.
And now: how to do the same with boundaries?
(And why doesn't it work with the other one?)

Achim

Achim

Moritz Lennert wrote:

On 26/06/09 15:24, achim wrote:

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
| Type of Map: vector (level: 2)
|
| Number of points: 0 Number of areas: 0
| Number of lines: 2326 Number of islands: 0
| Number of boundaries: 0 Number of faces: 0
| Number of centroids: 0 Number of kernels: 0
| Map is 3D: No
| Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

Probably none of your lines have categories. What does v.category my_lines option=report show ?

Moritz

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On 26/06/09 17:15, achim wrote:

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

That's why you have to run v.category option=add as I indicated in a previous mail.

Another example where it works partly:
| Type of Map: vector (level: 2)
| Number of points: 1 Number of areas: 56
| Number of lines: 0 Number of islands: 1
| Number of boundaries: 255 Number of faces: 0
| Number of centroids: 56 Number of kernels: 0
|
| Map is 3D: No
| Number of dblinks: 1

successfully created a table with 57 entries
?->.

What is the problem ?

And now: how to do the same with boundaries?

Why do you want your boundaries to have category values ? An area in GRASS is defined by the combination of boundaries with a centroid and the attribute data is attached to the centroid, not to the boundary.

If you really want cat values for your boundaries, again: use v.category option=add type=boundary.

Have you read:
http://grass.itc.it/grass64/manuals/html64_user/vectorintro.html
http://grass.osgeo.org/wiki/Vector_Database_Management

?

Moritz

Moritz

Sorry when getting on nerves with this stupid problem...
...for me its not stupid, but also getting on nerves.

...I always did and do:
v.category --overwrite input=my_lines@achim output=my_lines2 type=line layer=1
Vector map <my_lines2> already exists and will be overwritten
Processing features...
Copying attribute table(s)...
Building topology for vector map <my_lines2>...
Registering primitives...
    20002326 primitives registered
4652 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 2410
Number of primitives: 2326
Number of points: 0
Number of lines: 2326
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.category complete. 2326 features modified.

...now I get:
v.category -g input=my_lines2@achim output=my_lines2 option=report type=line
1 line 2326 1 2326
1 all 2326 1 2326

...but nothing is seen with 'table manager'...
(because categorization is to store 'hard' in the geometry layer and not 'soft' in the corresponding table. For this a v.to.db has to be done?)

now:
v.to.db map=my_lines2@achim option=cat
Reading features...
Updating database...
2326 categories read from vector map (layer 1)
2326 categories read from vector map don't exist in selection from table
2326 records updated/inserted (layer 1)

...and all is done. All I wanted is seen with 'table manager'!

> If you really want cat values for your boundaries, again: use v.category
> option=add type=boundary
eg. sometimes it is useful to describe features of borders between two areas with v.to.db -option=sides

More on my wishes..later in a mail.

For now: thank you very much for helping! Sometimes a spoken word and a little hint in physical presence is easier. But maybe one or another can avoid mistakes reading this.

Best regards,
Achim

Moritz Lennert wrote:

On 26/06/09 17:15, achim wrote:

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

That's why you have to run v.category option=add as I indicated in a previous mail.

Another example where it works partly:
| Type of Map: vector (level: 2)
| Number of points: 1 Number of areas: 56
| Number of lines: 0 Number of islands: 1
| Number of boundaries: 255 Number of faces: 0
| Number of centroids: 56 Number of kernels: 0
|
| Map is 3D: No
| Number of dblinks: 1

successfully created a table with 57 entries
?->.

What is the problem ?

And now: how to do the same with boundaries?

Why do you want your boundaries to have category values ? An area in GRASS is defined by the combination of boundaries with a centroid and the attribute data is attached to the centroid, not to the boundary.

If you really want cat values for your boundaries, again: use v.category option=add type=boundary.

Have you read:
http://grass.itc.it/grass64/manuals/html64_user/vectorintro.html
http://grass.osgeo.org/wiki/Vector_Database_Management

?

Moritz

Moritz

Hi,

when I run v.net, shouldn't I see two layers in the table-manager?
Wouldn't it be much more comfortable if it was possible to tell the modules to create a table?

I managed the problem with some difficulties. Its definitively not obvious how the workflow should be.

The metadata from aaa_temp are (No of dblinks 1)

  | Type of Map: vector (level: 2)
  | Number of points: 218 Number of areas: 0

  | Number of lines: 134 Number of islands: 0

  | Number of boundaries: 0 Number of faces: 0
  | Number of centroids: 0 Number of kernels: 0
  |
  | Map is 3D: No
  | Number of dblinks: 1

Table-manager shows nothing!*

when I run v.category with report, I get:
v.category --overwrite input=aaa_temp@achim output=aaa_temp2@achim option=report type=point layer=2
Layer/table: 1/aaa_temp
type count min max
point 0 0 0
line 134 1 134
boundary 0 0 0
centroid 0 0 0
area 0 0 0
all 134 1 134

(I have to define an output-vector for report!???) <-----?

So I add a layer for the nodes myself
v.category --overwrite input=aaa_temp@achim output=aaa_temp2@achim type=point layer=2
Vector map <aaa_temp2> already exists and will be overwritten
Table <aaa_temp2> linked to vector map <aaa_temp2> does not exist
Processing features...
Copying attribute table(s)...
DBMI-SQLite driver error:
Error in sqlite3_prepare():select * from aaa_temp where 0 =
1
no such table: aaa_temp
Unable to open select cursor: 'select * from aaa_temp where 0 = 1'
Unable to copy table <aaa_temp2>
Failed to copy attribute table to output map
Building topology for vector map <aaa_temp2>...
Registering primitives...
352 primitives registered
2678 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 218
Number of primitives: 352
Number of points: 218
Number of lines: 134
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.category complete. 218 features modified.

v.category --overwrite input=aaa_temp2@achim output=aaa_temp2@achim option=report type=point layer=2
Layer/table: 1/aaa_temp2
type count min max
point 0 0 0
line 134 1 134
boundary 0 0 0
centroid 0 0 0
area 0 0 0
all 134 1 134
Layer: 2
type count min max
point 218 1 218
line 0 0 0
boundary 0 0 0
centroid 0 0 0
area 0 0 0
all 218 1 218

>>When I add a new table I get:
v.db.addtable map=aaa_temp2@achim

Using vector map name as table name: aaa_temp2
ERROR: There is already a table linked to layer <1>

>>Although the connection information gives (*):
v.db.connect -p map=aaa_temp2@achim

layer <1> table <aaa_temp2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <aaa_temp2@achim> is connected by:

>>So I delete the connection and build a new table:
v.db.addtable map=aaa_temp2@achim

Using vector map name as table name: aaa_temp2
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <aaa_temp2> is now part of vector map <aaa_temp2@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
134 categories read from vector map (layer 1)
134 categories read from vector map don't exist in selection from table
134 records updated/inserted (layer 1)
Current attribute table links:
Vector map <aaa_temp2@achim> is connected by:
layer <1> table <aaa_temp2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>

>>And another for layer 2:
v.db.addtable map=aaa_temp2@achim layer=2

Using vector map name extended by layer number as table name: aaa_temp2_2
Creating table with columns (cat integer)
The table <aaa_temp2_2> is now part of vector map <aaa_temp2@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
layer <1> table <aaa_temp2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
layer <2> table <aaa_temp2_2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
218 categories read from vector map (layer 2)
218 categories read from vector map don't exist in selection from table
218 records updated/inserted (layer 2)
Current attribute table links:
Vector map <aaa_temp2@achim> is connected by:

v.db.connect -p map=aaa_temp2@achim

layer <1> table <aaa_temp2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
layer <2> table <aaa_temp2_2> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <aaa_temp2@achim> is connected by:

>>So now I can see the information in the table manager. And now I can run network-tools, understanding what happens.

Comments welcomed,
Achim

On 26/06/09 16:38, achim wrote:

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

Well, then you need to add them with 'v.category option=add'

:wink:
Moritz

Achim

Moritz Lennert wrote:

On 26/06/09 15:24, achim wrote:

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
| Type of Map: vector (level: 2)
|
| Number of points: 0 Number of areas: 0
| Number of lines: 2326 Number of islands: 0
| Number of boundaries: 0 Number of faces: 0
| Number of centroids: 0 Number of kernels: 0
| Map is 3D: No
| Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

Probably none of your lines have categories. What does v.category my_lines option=report show ?

Moritz

:slight_smile:

achim

Moritz Lennert schrieb:

On 26/06/09 16:38, achim wrote:

Thats exactly the problem: It shows nothing.
None of my lines has any cat.

Well, then you need to add them with 'v.category option=add'

:wink:
Moritz

Achim

Moritz Lennert wrote:

On 26/06/09 15:24, achim wrote:

Hi Moritz,

thanks for reply and this detailed explanation.

I try to report my problem with an example:
reset to initial point

v.db.connect -d map=my_lines@achim
db.droptable -f table=testtable

my_lines:
| Type of Map: vector (level: 2)
|
| Number of points: 0 Number of areas: 0
| Number of lines: 2326 Number of islands: 0
| Number of boundaries: 0 Number of faces: 0
| Number of centroids: 0 Number of kernels: 0
| Map is 3D: No
| Number of dblinks: 0

Number of nodes: 2410

(with grass65 wx-gui)
v.db.addtable map=my_lines@achim table=testtable
Using user specified table name: testtable
Creating new DB connection based on default mapset settings...
Creating table with columns (cat integer)
The table <testtable> is now part of vector map <my_lines@achim> and may be deleted or overwritten by GRASS modules
Select privileges were granted on the table
Reading features...
Updating database...
0 categories read from vector map (layer 1)
0 records updated/inserted (layer 1)
Current attribute table links:
layer <1> table <testtable> in database </home/achim/grass/sqlite_db> through driver <sqlite> with key <cat>
Vector map <my_lines@achim> is connected by:

?here no records updated/inserted

Probably none of your lines have categories. What does v.category my_lines option=report show ?

Moritz

On 29/06/09 17:28, achim wrote:

Hi,

when I run v.net, shouldn't I see two layers in the table-manager?

No. Just because you have different layers of categories does not necessarily mean that you need to have tables connected to each of these layers.

Wouldn't it be much more comfortable if it was possible to tell the modules to create a table?

It should be possible to add an option that would do that. File an enhancement wish about it.

Moritz