v.db.addtable.html 2.2 KB

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