table of contents
- NAME
- KEYWORDS
- DESCRIPTION
- Creating a PostgreSQL database
- Connecting GRASS to PostgreSQL
- Supported SQL commands
- Operators available in conditions
- Adding an unique ID column
- Attribute import into PostgreSQL
- Geometry import from PostgreSQL table into GRASS
- PostGIS: PostgreSQL with vector geometry
- SEE ALSO
- REFERENCES
other versions
- jessie 6.4.4-1
- stretch 7.2.0-2
- testing 7.6.0-1
- unstable 7.6.0-1
- experimental 7.6.1-1~exp1
grass-pg(1grass) | Grass User's Manual | grass-pg(1grass) |
NAME¶
grass-pg - PostgreSQL driver PostgreSQL driver PostgreSQL DB driver in GRASSKEYWORDS¶
database, attribute table, driverDESCRIPTION¶
The DB (database) driver name in GRASS is pg.Creating a PostgreSQL database¶
A new database is created with createdb, see the PostgreSQL manual for details.Connecting GRASS to PostgreSQL¶
Supported SQL commands¶
All SQL commands supported by PostgreSQL. It's not possible to use C-like escapes (with backslash like \n etc) within the SQL syntax.Operators available in conditions¶
All SQL operators supported by PostgreSQL.Adding an unique ID column¶
Import vector module require an unique ID column which can be generated as follows in a PostgreSQL table:Attribute import into PostgreSQL¶
CSV import into PostgreSQL:Geometry import from PostgreSQL table into GRASS¶
v.in.db creates a new vector (points) map from a database table containing coordinates. See here for examples.PostGIS: PostgreSQL with vector geometry¶
PostGIS: adds geographic object support to PostgreSQL.Example: Import from PostGIS¶
In an existing PostGIS database, create the following table:id serial NOT NULL,
mytime timestamp DEFAULT now(),
text varchar,
wkb_geometry geometry,
CONSTRAINT test_pkey PRIMARY KEY (id)
VALUES ('Name',geometryFromText('POLYGON((600000 200000,650000
200000,650000 250000,600000 250000,600000 200000))',-1));
output=test type=boundary,centroid
Geometry Converters¶
- PostGIS with shp2pgsql:
- e00pg: E00 to PostGIS filter, see also v.in.e00.
- GDAL/OGR ogrinfo and ogr2ogr: GIS vector format converter and library,
e.g. ArcInfo or SHAPE to PostGIS.
SEE ALSO¶
db.connect, db.execute Database management in GRASS GIS,REFERENCES¶
- PostgreSQL web site
- pgAdmin graphical user interface
- GDAL/OGR PostgreSQL driver documentation
GRASS 6.4.4 |