1grass-pg(1)                   Grass User's Manual                  grass-pg(1)
2
3
4
5PostgreSQL driver in GRASS The driver name is 'pg'.
6

Creating a PostgreSQL database

8       A  new  database  is created with 'createdb', see the PostgreSQL manual
9       for details.
10

Connecting GRASS to PostgreSQL

12
13       # example for connecting to a PostgreSQL server:
14       db.connect driver=pg database="host=myserver.itc.it,dbname=mydb"
15       db.login user=myname pass=secret
16       db.connect -p
17       db.tables -p
18
19

Supported SQL commands

21       All SQL commands supported by PostgreSQL.
22

Operators available in conditions

24       All SQL operators supported by PostgreSQL.
25

Adding an unique ID column

27       Import vector module require an unique ID column which can be generated
28       as follows in a PostgreSQL table:
29       echo "
30        ALTER TABLE mytable ADD ID integer;
31        CREATE SEQUENCE mytable_seq;
32        UPDATE mytabe SET ID = nextval('mytable_seq');
33        DROP SEQUENCE mytable_seq;
34       " | db.execute
35
36

Attribute Converters

38       CSV import into PostgreSQL:
39       \h copy
40       COPY t1 FROM 'filename' USING DELIMITERS ',';
41        pg2xbase: DBF to PostgreSQL converter.
42

PostGIS: PostgreSQL with vector geometry

44       PostGIS: add geographic object support to PostgreSQL.
45
46   Geometry Converters
47                     PostGIS with shp2pgsql:
48                     shp2pgsql -D lakespy2 lakespy2 test > lakespy2.sql
49
50                     e00pg: E00 to PostGIS filter, see also v.in.e00.
51
52                     GDAL/OGR ogrinfo and ogr2ogr: GIS vector format converter
53                     and library, e.g. ArcInfo or SHAPE to PostGIS.
54                     ogr2ogr -f "PostgreSQL" shapefile ??
55

SEE ALSO

57        db.execute,
58       Database management in GRASS GIS,
59       Help pages for database modules,
60       SQL support in GRASS GIS
61        PostgreSQL web site,
62       pgAdmin graphical user interface
63
64       Book: PostgreSQL: Introduction and Concepts by Bruce Momjian
65       PostgreSQL Documentation
66       PostgreSQL Technical Documentation
67       GDAL/OGR PostgreSQL driver documentation
68       MapServer Wiki
69
70       Last changed: $Date: 2006/08/24 19:11:36 $
71       Help Index
72
73
74
75GRASS 6.2.2                                                        grass-pg(1)
Impressum