[GRASS-CVS] markus: grass6/db/drivers/postgres grass-pg.html, 1.3, 1.4

grass at intevation.de grass at intevation.de
Sat Nov 24 07:36:22 EST 2007


Author: markus

Update of /grassrepository/grass6/db/drivers/postgres
In directory doto:/tmp/cvs-serv16350

Modified Files:
	grass-pg.html 
Log Message:
PostGIS example added (thanks to Horst Düster)

Index: grass-pg.html
===================================================================
RCS file: /grassrepository/grass6/db/drivers/postgres/grass-pg.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- grass-pg.html	18 Jul 2007 14:10:27 -0000	1.3
+++ grass-pg.html	24 Nov 2007 12:36:20 -0000	1.4
@@ -70,7 +70,40 @@
 <h2>PostGIS: PostgreSQL with vector geometry</h2>
 
 <a href=http://postgis.refractions.net/>PostGIS</a>: 
-add geographic object support to PostgreSQL.
+adds geographic object support to PostgreSQL.
+
+<h3>Example: Import from PostGIS</h3>
+
+In an existing PostGIS database, create the following table:
+
+<div class="code"><pre>
+CREATE TABLE test
+(
+ id serial NOT NULL,
+ mytime timestamp DEFAULT now(),
+ text varchar,
+ wkb_geometry geometry,
+ CONSTRAINT test_pkey PRIMARY KEY (id)
+) WITHOUT OIDS;
+
+# insert value
+INSERT INTO test (text, wkb_geometry)
+ VALUES ('Name',geometryFromText('POLYGON((600000 200000,650000
+ 200000,650000 250000,600000 250000,600000 200000))',-1));
+
+# register geometry column
+select AddGeometryColumn ('postgis', 'test', 'geometry', -1, 'GEOMETRY', 2);
+</pre></div>
+
+GRASS can import this PostGIS polygon map as follows:
+
+<div class="code"><pre>
+v.in.ogr dsn="PG:host=localhost dbname=postgis user=neteler" layer=test \
+         output=test type=boundary,centroid
+v.db.select test
+v.info -t test
+</pre></div>
+
 
 <h4>Geometry Converters</h4>
 <ul>




More information about the grass-commit mailing list