PostGIS: Difference between revisions
Line 21: | Line 21: | ||
There is a fundamental difference between the PostGIS format which is | There is a fundamental difference between the PostGIS format which is | ||
non-topological and the internal GRASS format which is topological and | 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 | which, thus, does not really allow for overlapping polygons. You can | ||
digitize them, but they are not really useful... | digitize them, but they are not really useful... | ||
You | == Link into GRASS == | ||
You can register a PostGIS layer into GRASS using {{cmd|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#Vector data|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. {{cmd|v.db.connect}} | You can link a GRASS layer to a PostgreSQL attribute table, though. {{cmd|v.db.connect}} |
Revision as of 10:18, 29 October 2011
See also working with external data in GRASS 7.
Help pages
- Database management in GRASS GIS help page
- SQL support in GRASS GIS help page
- PostgreSQL driver in GRASS help page
- ODBC driver in GRASS help page
Link to external dataset
- input maps: v.external
- (in GRASS 6 links are read only, for GRASS 7 see working with external data in GRASS 7)
- output maps: v.external.out (GRASS 7 only)
Import into GRASS
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