PostGIS

From GRASS-Wiki
Jump to navigation Jump to search

See also working with external data in GRASS 7.

Help pages

Link to external dataset

Import into GRASS

  1. v.in.ogr (import only geometry column from postgresql/postgis)
  2. v.clean

There is a fundamental difference between the PostGIS format which is non-topological (OGC simple feature-based) and the internal GRASS format which is topological and which, thus, does not really allow for overlapping polygons. You can digitize them, but they are not really useful...

Link into GRASS

You can register a PostGIS layer into GRASS using v.external, eg. PostGIS layer 'lakes' from database 'pgis_nc'

v.external dsn=PG:dbname=pgis_nc layer=lakes

It will create in the current mapset new vector map 'lakes', the module also builds pseudo-topology for this map,

Important note: In GRASS 6 this link is read-only, in GRASS 7 it's possible to modify linked layers directly via OGR library, see working with external data in GRASS 7.

In GRASS 7, you can directly process a PostGIS layers in GRASS

You can link a GRASS layer to a PostgreSQL attribute table, though. v.db.connect

See also