[GRASSweb-list]markus: web/grass51/tutorial geom_storage.html,1.21,1.22 index.html,1.23,1.24
grass at intevation.de
grass at intevation.de
Mon Nov 10 12:27:17 EST 2003
Author: markus
Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv17861
Modified Files:
geom_storage.html index.html
Log Message:
example added how to create GRASS map from PostGIS table
Index: geom_storage.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/geom_storage.html,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- geom_storage.html 21 Oct 2003 12:39:18 -0000 1.21
+++ geom_storage.html 10 Nov 2003 17:27:15 -0000 1.22
@@ -314,6 +314,53 @@
<p><table width="100%" cellpadding="3" border="0">
<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
+<a name="frompostgis"></a>
+Generating vector geometry from PostGIS table
+<DIV ALIGN=right><a href="#sites">[UP]</a></DIV>
+</b></big></font></td></tr></table>
+
+It is also possible to create a GRASS map from a PostGIS
+table where the coordinates are in PostGIS GEOMETRY:
+present.
+<P>
+Here we assume to have a PostgreSQL table with columns 'x', 'y', 'num' (ID)
+and some attribute columns:
+<div class="code"><pre>
+#establish the connection with db tools to verify the table:
+db.connect dr=pg data="host=pgserver.itc.it,user=myname,dbname=mitris"
+db.connect -p
+
+#see tables:
+db.tables -p
+
+#NOTE - it would be better to create a VIEW of the table:
+echo "select x(geo),y(geo),num from localizzazione" | db.select -c
+
+#generate map from geometry/ID:
+echo "select x(geo),y(geo),num from localizzazione" | db.select -c | v.in.ascii out=mitris
+v.info mitris
+</pre></div>
+The command above created the new vector map (native format). Finally we have to
+link the attributes table to the map:
+
+<div class="code"><pre>
+v.db.connect -p
+v.db.connect -o mitris dr=pg
+data="host=pgserver.itc.it,user=myname,dbname=mitris" table=localizzazione key=num
+</pre></div>
+<P>
+Now we can display and query some points:
+<div class="code"><pre>
+d.vect mitris
+d.what.vect
+</pre></div>
+<P>
+Note that the map was linked to the table. When you delete the map, also
+the PostGIS table 'localizzazione' would be deleted! (This behaviour should
+be discussed...).
+
+<p><table width="100%" cellpadding="3" border="0">
+<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
<a name="sites2"></a>
Generating vector geometry from XY or XYZ file
<DIV ALIGN=right><a href="#sites">[UP]</a></DIV>
Index: index.html
===================================================================
RCS file: /grassrepository/web/grass51/tutorial/index.html,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- index.html 21 Oct 2003 12:39:18 -0000 1.23
+++ index.html 10 Nov 2003 17:27:15 -0000 1.24
@@ -52,6 +52,7 @@
using PostGIS</a>
<li><a href="geom_storage.html#OGR">Geometry access through OGR</a>
<li><a href="geom_storage.html#sites">Generating vector geometry from spreadsheet or DBMS table</a>
+ <li><a href="geom_storage.html#frompostgis">Generating vector geometry from PostGIS table</a>
<li><a href="geom_storage.html#sites2">Generating vector geometry from XY or XYZ file</a>
</ol>
More information about the grass-web
mailing list