[GRASSweb-list]markus: web/grass51/tutorial examples.html,1.2,1.3
grass at intevation.de
grass at intevation.de
Mon Jan 13 13:10:41 EST 2003
Author: markus
Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv14533
Modified Files:
examples.html
Log Message:
new example added
Index: examples.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/examples.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- examples.html 31 Dec 2002 14:40:23 -0000 1.2
+++ examples.html 13 Jan 2003 18:10:38 -0000 1.3
@@ -74,6 +74,8 @@
<li><a href="#SQL_queries">Example: SQL queries</a>
<li><a href="#shape_conversion">Example: Conversion of SHAPE map to GRASS
5.1 vector map</a>
+<li><a href="#map_from_points">Example: Generating a vector map from a point data
+ table</a>
</ol>
@@ -286,7 +288,64 @@
d.what.vect newmap
</div></pre>
+<p><table width="100%" cellpadding="3" border="0">
+<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
+<a name="map_from_points"></a>
+Example: Generating a vector map from a point data table
+</b></big></font></td></tr></table>
+
+Assume you have a CSV (comma separated values) file and want to generate a
+map from that. That's rather easy. Convert the CSV file to dBase format with
+StarOffice or another software. Then store the DBF file into that directory,
+where you keep your DBF files for the current LOCATION (maybe where your
+SHAPE files live). The map be "BOTSD90.dbf". Connect the DBMI to that
+directory:
+
+<div class="code"><pre>
+db.connect driver=shp database=/ssi0/ssi/neteler/grassdata/botswanaLL/shp
+db.columns BOTSD90
+</div></pre>
+
+should display the columns. there must be of course an X and a Y column with
+coordinates inside. Then try to query the table to check if it's really
+working:
+
+<div class="code"><pre>
+echo "select X_COORD, Y_COORD, shp_fid from BOTSD90" | db.select -h
+</div></pre>
+<p>
+Note that "shp_fid" column is generated on the fly. Now we can generate the
+vector points map (which was the sites file in GRASS 5.0):
+<div class="code"><pre>
+echo "select X_COORD, Y_COORD, shp_fid from BOTSD90" | db.select -h |v.in.ascii output=BOTSD90map
+</div></pre>
+
+There we are!
+<div class="code"><pre>
+d.vect BOTSD90map
+</div></pre>
+<p>
+Finally we have to connect the table to the new vector map. Edit the DB file
+(if not there, generate it in the MAPSET directory) and add something like:
+
+<div class="code"><pre>
+BOTSD90map 1 BOTSD90 shp_fid /ssi0/ssi/neteler/grassdata/botswanaLL/shp shp
+</div></pre>
+(map field_1 table IDcolumn directory driver)
+<p>
+
+Query some points:
+<div class="code"><pre>
+d.what.vect -a BOTSD90map
+</div></pre>
+
+For amusement we export the map as SHAPE map:
+<div class="code"><pre>
+v.out.ogr BOTSD90map type=point dsn=./ layer=BOTSD90map
+</div></pre>
+
+Cheers.
<hr>
<b>Further Links:</b>
More information about the grass-web
mailing list