[GRASSweb-list]markus: web/grass51/tutorial attrib_storage.html,1.13,1.14 demo.html,1.6,1.7 ex_basic.html,1.2,1.3 ex_complex.html,1.2,1.3 examples.html,1.18,1.19 geom_storage.html,1.10,1.11 intro.html,1.1,1.2 techdocs.html,1.1,1.2

grass at intevation.de grass at intevation.de
Thu Feb 20 11:42:16 EST 2003


Author: markus

Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv3284

Modified Files:
	attrib_storage.html demo.html ex_basic.html ex_complex.html 
	examples.html geom_storage.html intro.html techdocs.html 
Log Message:
v.db.connect now also writes the dbln file - polished tutorial

Index: attrib_storage.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/attrib_storage.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- attrib_storage.html	12 Feb 2003 11:20:52 -0000	1.13
+++ attrib_storage.html	20 Feb 2003 16:42:14 -0000	1.14
@@ -79,11 +79,12 @@
 
 The connection of a vector map to an attribute table (except for SHAPE) is
 internally defined in a <tt>dbln</tt> file (an ASCII file in the vector map
-directory). This file is created whem importing/converting a map into GRASS
-5.1. The current connection for a map can be printed with <br>
+directory). This file is created when importing/converting a map into GRASS
+5.1 or can be generated with 'v.db.connect'. The current connection for a
+map can be printed with <br>
 
 <div class="code"><pre>
-v.db.connect vectmap
+v.db.connect -p vectmap
 </div></pre>
 
 
@@ -95,7 +96,7 @@
 </b></big></font></td></tr></table>
 
 Per default vector map attributes are stored in DBF tables.
-This definition can be modified with:
+This default definition can be modified with:
 
 <div class="code"><pre>
 v.database
@@ -139,7 +140,7 @@
 You can verify the connection of a vector map to a table:
 
 <div class="code"><pre>
-v.db.connect markveggy.shp
+v.db.connect -p markveggy.shp
 </div></pre>
 
 which should print the database connection to the related DBF file.
@@ -258,11 +259,12 @@
  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
-     vector map subdirectory):
+<li> Next link map to attribute table:
+
 <div class="code"><pre>
-# field table ID database DBMIdriver
-1 markveggy VEGCNP_ID grass51test odbc
+v.db.connect map=markveggy.shp table=markveggy key=VEGCNP_ID \
+             database=grass51test driver=odbc
+v.db.connect -p
 </div></pre>
 
 <li>
@@ -284,7 +286,7 @@
 table:
 
 <div class="code"><pre>
-v.db.connect markveggy.shp
+v.db.connect -p markveggy.shp
 </div></pre>
 
 which should print the database connection through ODBC to the defined RDBMS.
@@ -318,11 +320,10 @@
 </div></pre>
 This will open a password dialog for the PostgreSQL database.
 <p>
-Next add entry in the GRASS 5.1 'dbln' file (in the vector map directory)
-or generate this file:
+Next we link the vector geometry to the attributes table:
 <div class="code"><pre>
-#field table ID database DBMIdriver
-1 markveggy VEGCNP_ID host=pgserver,dbname=grass51test,user=neteler pg
+v.db.connect map=markveggy.shp table=markveggy key=VEGCNP_ID \
+             database='pgserver,dbname=grass51test,user=neteler' driver=pg
 </div></pre>
 
 Connect GRASS 5.1 to the table:
@@ -333,8 +334,9 @@
 
 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).
+could supply ',password=secretword' in the 'database' parameter of
+'v.db.connect' and 'db.connect', 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
@@ -342,13 +344,13 @@
 
 <P>
 Doesn't work? Check with 'psql -l' if the PostgreSQL
-connection is really established.
+connection generally established.
 
 You can also check the vector map itself concerning a current link to a
 table:
 
 <div class="code"><pre>
-v.db.connect markveggy.shp
+v.db.connect -p markveggy.shp
 </div></pre>
 
 which should print the database connection to PostgreSQL.

Index: demo.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/demo.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- demo.html	10 Feb 2003 17:32:26 -0000	1.6
+++ demo.html	20 Feb 2003 16:42:14 -0000	1.7
@@ -103,7 +103,7 @@
  <div class="code"><pre>
  d.vect net
  nviz el=dem vect=net
- v.db.connect net
+ v.db.connect -p net
  v.info net
  </div></pre></li>
 
@@ -145,7 +145,7 @@
  ./gen.long output=longcurve npoints=10000
  v.in.ascii in=longcurve out=longcurve
  v.info longcurve
- v.db.connect longcurve
+ v.db.connect -p longcurve
  g.region vect=longcurve -p
  d.erase
  d.vect longcurve

Index: ex_basic.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/ex_basic.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ex_basic.html	17 Feb 2003 15:49:07 -0000	1.2
+++ ex_basic.html	20 Feb 2003 16:42:14 -0000	1.3
@@ -72,7 +72,7 @@
 To convert 5.0 vector data to 5.1, run:
 <div class="code"><pre>
 v.convert in=vectormap_from_50 out=vectormap
-v.db.connect vectormap
+v.db.connect -p vectormap
 g.region -p vect=vectormap
 d.vect vectormap
 d.m
@@ -239,7 +239,7 @@
 #be the table from the parent map. Edit the DB file and add a row for
 #the new map (here: markveggy.1)
 #Then check connection:
-v.db.connect input=markveggy.1
+v.db.connect -p markveggy.1
 
 #Query new map with attributes:
 d.what.vect -a

Index: ex_complex.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/ex_complex.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ex_complex.html	17 Feb 2003 15:49:07 -0000	1.2
+++ ex_complex.html	20 Feb 2003 16:42:14 -0000	1.3
@@ -139,16 +139,12 @@
 </div></pre>
 
 We have the geometry and the attributes table ready now. Finally missing is
-the DB link definition for GRASS which is defined in the 'dbln' file:
-
-<div class="code"><pre>
-cd $HOME/grassdata/spearfish/user1/vector/streams_pg
-</div></pre>
+the link of the vector geometry to the attribute table:
 
-The 'dbln' file contains the connection parameters such as:
 <div class="code"><pre>
-#field table ID database DBMIdriver
-1 streams_atts CAT host=pgserver.itc.it,dbname=spearfish,user=postgres pg
+v.db.connect map=streams_pg table=streams_atts driver=pg \
+             database='pgserver.itc.it,dbname=spearfish,user=postgres'
+v.db.connect -p streams_pg 
 </div></pre>
 
 Now we should be able to look at and query the map with:
@@ -341,7 +337,7 @@
 1 markveggy VEGCNP_ID /ssi0/ssi/neteler/grassdata/botswanaLL/PERMANENT/shp dbf
 
 #check if it is connected:
-v.db.connect newmap
+v.db.connect -p newmap
 
 #draw & query
 d.erase

Index: examples.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/examples.html,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- examples.html	17 Feb 2003 15:49:07 -0000	1.18
+++ examples.html	20 Feb 2003 16:42:14 -0000	1.19
@@ -51,6 +51,7 @@
     (the same as in 5.0.x)
 <li>v.build v.build.polylines v.category v.clean v.convert v.database
 v.db.connect v.digit v.extract v.format v.in.ascii v.info v.in.ogr v.in.sites
+v.net.alloc
 v.out.ascii v.out.ogr v.patch v.surf.rst v.topo.check v.to.rast v.transform
 
 <li>

Index: geom_storage.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/geom_storage.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- geom_storage.html	18 Feb 2003 14:22:09 -0000	1.10
+++ geom_storage.html	20 Feb 2003 16:42:14 -0000	1.11
@@ -239,18 +239,18 @@
 <P>
 
 Here we assume to have a PostgreSQL table. The db.* modules allow us to
-select columns which are then piped into v.in.ascii. That's it for
-generating the map. Then, currently by hand, the 'dbln' file must be created to link the
-map to the table (to see the attributes):
+select columns which are then piped into 'v.in.ascii'. That's it for
+generating the map. Then the 'dbln' file must be created to link the
+map to the attributes table (with 'v.db.connect'):
 
 <div class="code"><pre>
-#define the connection:
-db.connect  driver=pg database="host=pgserver,dbname=grass51test,user=neteler"
+#define the connection for the db.* tools:
+db.connect driver=pg database="host=pgserver,dbname=grass51test,user=neteler"
 
 #check if connection is established:
 echo "select * from pat_centraline " | db.select
 
-#now be selective (-c suppresses the column names):
+#now let's be selective (-c suppresses the column names):
 echo "select east_gb,north_gb,quota_gb,codice from pat_centraline " | db.select -c
 
 #... and generate the map (3D points here):
@@ -259,17 +259,14 @@
 
 v.info pat_centraline
 
-#create 'dbln' file to connect map to attribute table
-cd `g.gisenv GISDBASE`/`g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`/vector
-</div></pre>
-
-The 'dbln' file may contain the line:
-<div class="code"><pre>
-1 pat_centraline codice host=pgserver,dbname=grass51test,user=neteler pg
+#link map to attribute table
+v.db.connect map=pat_centraline table=pat_centraline key=codice \
+             database="host=pgserver,dbname=grass51test,user=neteler" driver=pg
+v.db.connect -p pat_centraline
 </div></pre>
 
-Now we have linked the new vector map (native format now) to the attributes table
-in PostgreSQL. We can display and query some points:
+Now we have linked the new vector map (native format now) to the attributes
+table in PostgreSQL. We can display and query some points:
 <div class="code"><pre>
 d.vect pat_centraline
 d.what.vect

Index: intro.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/intro.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- intro.html	17 Feb 2003 15:49:24 -0000	1.1
+++ intro.html	20 Feb 2003 16:42:14 -0000	1.2
@@ -4,7 +4,7 @@
    <DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <DEFANGED_meta name="Author" content="Markus Neteler">
    <DEFANGED_link rel="stylesheet" type="text/css" href="../../sitestyle.css">
-   <title>GRASS 5.1 Usage examples</title>
+   <title>GRASS 5.1 tutorial introduction</title>
 </head>
 <body>
 
@@ -13,7 +13,7 @@
 <A HREF="index.html">
 <DEFANGED_IMG src="../../images/grass.smlogo.gif" alt="HOME" border="0" align=middle></A>
 </td><td><H1>
-GRASS 5.1 Troubleshooting
+GRASS 5.1 tutorial introduction
 </H1></td></tr></table>
 <!-- END OF HEADER -->
 
@@ -45,7 +45,7 @@
 Per default all GRASS 5.1 vectors are stored in native 5.1 format within the
 directory $GISDBASE/$LOCATION_NAME/$MAPSET/vector/$MAP/. All map related
 data such as geometry data, spatial index, DB-connection (dbln file) info
-etc. are stored in this directory. Maps can be read from SHAPE files
+etc. are stored in this directory. Geometry can be also read from SHAPE files
 directly, read and written to PostGRASS (using PostGIS) and in future
 through OGR. See <i>Geometry management</i> below for details. <p>
 
@@ -53,8 +53,16 @@
 
 Per default all GRASS 5.1 vector attributes are stored in a DBF table within
 the directory $GISDBASE/$LOCATION_NAME/$MAPSET/dbf. The default settings
-(DBMI driver and DATABASE) can be modified with 'v.database'.
-See <i>Attribute management</i> below for details.
+for attribute storage can be modified with 'v.database'.
+If required, a map can be linked to a certain table with 'v.db.connect'.
+See <i>Attribute management</i> below for details. <P>
+
+<b>Default settings for db.* modules</b><p>
+
+The db.* set of modules can be used for simple SQL tasks in database tables.
+Connection must be established with 'db.connect' first. See <i>Attribute
+management</i> below for details.
+
 
 <h3>Tutorial Quick Guide</h3>
 

Index: techdocs.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/techdocs.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- techdocs.html	10 Feb 2003 17:32:26 -0000	1.1
+++ techdocs.html	20 Feb 2003 16:42:14 -0000	1.2
@@ -4,7 +4,7 @@
    <DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <DEFANGED_meta name="Author" content="Markus Neteler">
    <DEFANGED_link rel="stylesheet" type="text/css" href="../../sitestyle.css">
-   <title>GRASS 5.1: Attribute management with connections to DBMS</title>
+   <title>GRASS 5.1: Some vector API docs</title>
 </head>
 <body>
 
@@ -13,7 +13,7 @@
 <A HREF="index.html">
 <DEFANGED_IMG src="../../images/grass.smlogo.gif" alt="HOME" border="0" align=middle></A>
 </td><td><H1>
-GRASS 5.1: Attribute management with connections to DBMS
+GRASS 5.1: Some vector API docs
 </H1></td></tr></table>
 <!-- END OF HEADER -->
 
@@ -34,11 +34,27 @@
 <i>
 These examples described here may work or not. You are kindly invited to
 send us further examples and/or code bugfixes/enhancements.</i>
+
+<h3>Why is the 5.1 vector engine faster than 5.0?</h3>
+
+One reason is that the 'cat's are stored in the geometry file now (in 5.0 it
+was in a separate file), the second reason is the use of a spatial index.
+
+<h3>What is this 'field' thing?</h3>
+
+The field is used to link one or several attribute tables to a vector map.
+Per default field=1 for each vector line: link to table 1. But it is
+possible that each vector has a different field value, so that
+various lines in a vector map link to different tables (through the 'dbln'
+file).<br>
+When digitizing with 'v.digit' the field can be set for each vector.
 <P>
+The normal user will not care about 'field'.
 
 <h3>Vector data 'dbln' file mechanism</h3>
 
-The "normal" user does not have to care about this file.
+The "normal" user does not have to care about this file (it is usually
+generated automatically or can be written with 'v.db.connect').
 The following text describes some API internals.
 
 <center>
@@ -72,9 +88,11 @@
 Wild cards * and ? may be used.  Variables GISDBASE, $LOCATION, $FIELD may
 be used in table, key, database and driver names.
 Normally the <tt>dbln</tt> file is generated by GRASS.
-
 <P>
-<h3>Default settings</h3>
+The SHAPE driver does not use the <tt>dbln</tt> file.
+
+
+<h3>Default vector data storage settings</h3>
 
 Default settings are defined in the file<BR>
 <tt>$GISDBASE/$LOCATION_NAME/$MAPSET/VAR</tt>
@@ -83,6 +101,12 @@
 If a new map is generated, the VAR settings are used.
 
 
+<h3>Differences between DBF and SHAPE driver</h3>
+
+In contrast to the DBF driver the SHAPE driver provides on-the-fly a
+virtual column 'shp_id'.
+
+<P>
 <hr>
 <P>
 Further <a href=links.html>Links</a> (related software, SQL reference etc).





More information about the grass-web mailing list