[GRASS-user] tables connection in database
achim
ak7 at jupiter.uni-freiburg.de
Fri Jun 26 09:24:41 EDT 2009
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 at 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 at 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 at 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 at achim> is connected by:
?here no records updated/inserted
(with grass65 wx-gui)
v.to.db map=my_lines at 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
More information about the grass-user
mailing list