[GRASS-user] tables connection in database

Moritz Lennert mlennert at club.worldonline.be
Fri Jun 26 08:43:33 EDT 2009


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


More information about the grass-user mailing list