[GRASSweb-list]markus: web/grass51/tutorial attrib_storage.html,1.12,1.13
grass at intevation.de
grass at intevation.de
Wed Feb 12 06:20:54 EST 2003
Author: markus
Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv3714
Modified Files:
attrib_storage.html
Log Message:
cleanup
Index: attrib_storage.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/attrib_storage.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- attrib_storage.html 10 Feb 2003 17:32:25 -0000 1.12
+++ attrib_storage.html 12 Feb 2003 11:20:52 -0000 1.13
@@ -41,6 +41,7 @@
<a name="toc"></a>
<ol>
<li><a href="#intro">Introduction</a>
+<li><a href="#default">Managing the default settings</a>
<li><a href="#DBF">Attributes stored in DBF table</a>
<li><a href="#ODBC">Attributes stored in external database (PostgreSQL)
connected through ODBC</a>
@@ -84,9 +85,39 @@
<div class="code"><pre>
v.db.connect vectmap
</div></pre>
+
+
+<p><table width="100%" cellpadding="3" border="0">
+<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
+<a name="default"></a>
+Managing the default settings
+<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
+</b></big></font></td></tr></table>
+
+Per default vector map attributes are stored in DBF tables.
+This definition can be modified with:
+
+<div class="code"><pre>
+v.database
+</div></pre>
<P>
-The settings for the db.* modules (Driver and Database) can
+Possible settings are (examples):
+<ul>
+<li>DBF: driver=dbf<br>
+ database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf'
+<li>ODBC: driver=odbc<br>
+ database=grass51test
+<li>PostgreSQL: driver=pg<br>
+ database='host=pgserver.itc.it,dbname=grass51test,user=name'
+<li>mySQL: driver=mysql<br>
+ database=?
+</ul>
+
+<b>The db.* modules are independent from the v.* modules and just
+a tool collection to modify attribute tables.</b><br>
+
+The connection settings for the db.* modules (Driver and Database) can
be defined/modified with 'db.connect'. To set it to the same settings as
the v.* modules use per default, run:
@@ -101,11 +132,11 @@
<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
</b></big></font></td></tr></table>
-Example: Connection of SHAPE file with attributes in DBF file which was
+Example: SHAPE file with attributes in DBF file which was
registered with 'v.format' (see <a href=geom_storage.html#SHAPE>here</a>).
<p>
-You can check the connection of a vector map to a table:
+You can verify the connection of a vector map to a table:
<div class="code"><pre>
v.db.connect markveggy.shp
@@ -114,14 +145,14 @@
which should print the database connection to the related DBF file.
<P>
If you want to use the <tt>db.*</tt> commands, you first have to connect
-GRASS 5.1 to the table's directory:
+them to the DBF database:
<div class="code"><pre>
db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf'
db.tables -p
</div></pre>
-... which prints the available tables for that connection.
+... which prints the available tables.
<p><table width="100%" cellpadding="3" border="0">
@@ -133,54 +164,29 @@
</b></big></font></td></tr></table>
Possible communication between GRASS 5.1 and PostgreSQL database for
- attribute management (ODBC can connect to other RDBMS as well): <p>
+ attribute management (ODBC can connect to other RDBMS as well): <br>
<table cellpadding="2" cellspacing="2" border="1" align="center">
<tbody>
<tr>
- <td valign="top" align="center" bgcolor="#99ff99">GRASS module <->
- DBMI <-> ODBCdriver</td>
- <td valign="top" align="center" bgcolor="#99ff99"><-> </td>
- <td valign="top" align="center" bgcolor="#99ff99">unixODBC</td>
- <td valign="top" align="center" bgcolor="#99ff99"><--> </td>
- <td valign="top" align="center" bgcolor="#99ff99">ODBC-to-RDBMS-driver
- <-> RDBMS Database</td>
+ <td valign="top" align="center" bgcolor="#FFBB99">GRASS module <-> </td>
+ <td valign="top" align="center" bgcolor="#FFBB99"><--> </td>
+ <td valign="top" align="center" bgcolor="#FFBB99">ODBC Interface</td>
+ <td valign="top" align="center" bgcolor="#FFBB99"><--> </td>
+ <td valign="top" align="center" bgcolor="#FFBB99">RDBMS</td>
</tr>
<tr>
- <td valign="top" align="center"><i><b>GRASS<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>Interface<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>PostgreSQL<br>
- </b></i></td>
+ <td valign="center" align="center" rowspan=3 bgcolor="#BBffBB"><i><b>GRASS</b></i></td>
+ <td valign="center" align="center" rowspan=3 bgcolor="#BBffBB"><i><b>DBMI driver</b></i></td>
+ <td valign="center" align="center" rowspan=3><i><b>unixODBC</b></i></td>
+ <td valign="center" align="center" rowspan=3><i><b>ODBC driver</b></i></td>
+ <td valign="top" align="center" bgcolor="#FFffBB"><i><b>PostgreSQL</b></i></td>
</tr>
<tr>
- <td valign="top" align="center"><i><b>GRASS<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>Interface<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>Oracle<br>
- </b></i></td>
+ <td valign="top" align="center" bgcolor="#FFffBB"><i><b>Oracle</b></i></td>
</tr>
<tr>
- <td valign="top" align="center"><i><b>GRASS<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>Interface<br>
- </b></i></td>
- <td valign="top" align="center"><i><b><-><br>
- </b></i></td>
- <td valign="top" align="center"><i><b>...<br>
- </b></i></td>
+ <td valign="top" align="center" bgcolor="#FFffBB"><i><b>...</b></i></td>
</tr>
</tbody>
</table>
@@ -239,18 +245,17 @@
<tt>psql -V</tt>
<li>
-Now create a new database if not yet existing ('-h host' defines the
- PostgreSQL server host if not localhost):
+Now create a new database if not yet existing:
<div class="code"><pre>
-createdb -h rastrel grass51test
+db.createdb driver=odbc database=grass51test
</div></pre>
-<li>Now store the table 'markveggy.dbf' into PostgreSQL:
+<li>Now store the table 'markveggy.dbf' (in current directory) into PostgreSQL
+through ODBC:
<div class="code"><pre>
db.connect driver=odbc database=grass51test
db.copy from_driver=dbf from_database=./ from_table=markveggy \
- to_driver=pg to_database="host=pgserver,dbname=grass51test" \
- to_table=markveggy
+ to_driver=odbc to_database=grass51test to_table=markveggy
</div></pre>
<li> Next add an entry in the GRASS 5.1 'dbln' file (put this into the
@@ -267,7 +272,7 @@
db.tables -p
db.columns table=markveggy
</div></pre>
-Now the table name 'markveggy' should be printed which is the PostgreSQL table.
+Now the table name 'markveggy' should appear.
<P>
Doesn't work? Check with 'isql <databasename>' if the ODBC-PostgreSQL
connection is really established.
@@ -296,22 +301,25 @@
directly connected to GRASS 5.1.<p>
If not yet done, create a new database if not yet existing ('-h host'
-defines the PostgreSQL server host if not localhost):
+defines the PostgreSQL server host if not localhost). Here we
+assume that PostgreSQL runs on machine 'pgserver':
<div class="code"><pre>
-createdb -h rastrel grass51test
+db.connect driver=pg database="host=pgserver,dbname=grass51test,user=neteler"
+createdb -h pgserver grass51test
+<!-- not yet: db.createdb driver=pg database=grass51test -->
</div></pre>
Now store the table 'markveggy.dbf' into PostgreSQL:
<div class="code"><pre>
-db.connect driver=odbc database=grass51test
db.copy from_driver=dbf from_database=./ from_table=markveggy \
to_driver=pg to_database="host=pgserver,dbname=grass51test,user=neteler" \
to_table=markveggy
</div></pre>
+This will open a password dialog for the PostgreSQL database.
<p>
-Let's assume that PostgreSQL runs on machine 'pgserver'.
-Add entry in the GRASS 5.1 'dbln' file in the vector map directory:
+Next add entry in the GRASS 5.1 'dbln' file (in the vector map directory)
+or generate this file:
<div class="code"><pre>
#field table ID database DBMIdriver
1 markveggy VEGCNP_ID host=pgserver,dbname=grass51test,user=neteler pg
@@ -319,18 +327,18 @@
Connect GRASS 5.1 to the table:
<div class="code"><pre>
-db.connect driver=pg database="host=pgserver,dbname=grass51test,user=neteler"
db.tables -p
db.describe -c markveggy
</div></pre>
-If, depending on the definition of the database 'grass51test' a password is
-required, a pop-up dialog window will ask you (alternatively you could supply
-',password=secretword' in <tt>dbln</tt> file and db.connect line, which is not
-recommended for security reasons).
+If, depending on the security settings of the PG database 'grass51test' a
+password is required, a pop-up dialog window will ask you (alternatively you
+could supply ',password=secretword' in <tt>dbln</tt> file and db.connect
+line, which is not recommended for security reasons).
-This should connect the map to the table. db.describe will print table name and
-columns of the table 'markveggy' which is stored as PostgreSQL table.
+This should connect the map to the table. 'db.describe' will print table
+name and columns of the table 'markveggy' which is stored as PostgreSQL
+table.
<P>
Doesn't work? Check with 'psql -l' if the PostgreSQL
@@ -352,8 +360,8 @@
<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
</b></big></font></td></tr></table>
-Example: Connection of SHAPE file with attributes in mySQL database table
-directly connected to GRASS 5.1.<p>
+Example: SHAPE file with attributes in mySQL database table
+using mySQL driver.<p>
TODO (will be similar to PostgreSQL).
@@ -425,7 +433,7 @@
Select the column and change the type to "Number" (alias Integer). Save the
table. Now GRASS 5.1 can use the ID column as it is of Integer type.
<br>
-PROBLEM: In OpenOffice 1.0.1 Number/Integer does not exist!! So you better
+PROBLEM: In OpenOffice 1.0.1 Number/Integer doesn't seem to exist!! So you better
go with StarOffice.
<hr>
More information about the grass-web
mailing list