-
-
Notifications
You must be signed in to change notification settings - Fork 291
/
v.db.addtable.html
64 lines (53 loc) · 2.26 KB
/
v.db.addtable.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<h2>DESCRIPTION</h2>
<em>v.db.addtable</em> creates and adds a new attribute table to a given vector
map. It links the table to the specified layer of the vector map. If the vector
map is not yet linked to any table, new a database link is established based on
the MAPSET database settings (see <em>db.connect</em>).
<h2>NOTES</h2>
<em>v.db.addtable</em> is a front-end to <em>db.execute</em> to allow easier
usage.
<p>
<em>v.db.addtable</em> will only insert category values into the table for those features
which actually have a category value in the relevant layer. The user can add
category values automatically by using <em>v.category</em> or manually with
<em><a href="wxGUI.vdigit.html">wxGUI vector digitizer</a></em>
before running v.db.addtable. Or one can run v.db.addtable first
and then use either a combinatino of <em>v.category</em> + <em>v.to.db</em> or
<em><a href="wxGUI.vdigit.html">wxGUI vector digitizer</a></em>
to add the relevant lines to the table.
<p>
The supported types of columns depend on the database backend. However, all
backends should support VARCHAR, INT, DOUBLE PRECISION and DATE.
<p>The existing database connection(s) can be verified with <em>v.db.connect</em>.
<h2>EXAMPLE</h2>
Adding a new attribute table with a single column to default layer 1:<br>
<div class="code"><pre>
g.copy vect=roadsmajor,myroads
v.db.addtable myroads columns="slope double precision"
v.db.connect -p myroads
v.info -c myroads
</pre></div>
<p>Adding a new attribute table with two columns to layer 2:<br>
<div class="code"><pre>
g.copy vect=roadsmajor,myroads
v.db.addtable myroads columns="slope double precision, roadname varchar(15)" layer=2
v.db.connect -p myroads
v.info -c myroads
v.info -c myroads layer=2
</pre></div>
<h2>SEE ALSO</h2>
<em>
<a href="db.connect.html">db.connect</a>,
<a href="db.droptable.html">db.droptable</a>,
<a href="db.execute.html">db.execute</a>,
<a href="v.db.addtable.html">v.db.addtable</a>,
<a href="v.db.connect.html">v.db.connect</a>,
<a href="v.db.dropcolumn.html">v.db.dropcolumn</a>,
<a href="v.db.droptable.html">v.db.droptable</a>,
<a href="v.db.select.html">v.db.select</a>,
<a href="v.db.update.html">v.db.update</a><br>
<a href="sql.html">GRASS SQL interface</a>
</em>
<h2>AUTHOR</h2>
Markus Neteler
<p><i>Last changed: $Date$</i>