other versions
- wheezy 6.4.2-2
- jessie 6.4.4-1
- testing 7.2.0-2
- unstable 7.2.0-2
- experimental 7.2.1-1~exp1
grass-pg(1grass) | Grass User's Manual | grass-pg(1grass) |
NAME¶
grass-pg - PostgreSQL driverCreating 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 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:ALTER TABLE mytable ADD ID integer;
CREATE SEQUENCE mytable_seq;
UPDATE mytabe SET ID = nextval('mytable_seq');
DROP SEQUENCE mytable_seq;
Attribute Converters¶
CSV import into PostgreSQL:Geometry import from PostgreSQL table¶
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,GRASS 6.4.2 |