| 56 | |----------------------------------------------------------------------------| |
| 57 | ... |
| 58 | }}} |
| 59 | |
| 60 | '''Write example:''' |
| 61 | |
| 62 | {{{ |
| 63 | # define output vector format |
| 64 | v.external.out dsn=PG:dbname=grass format=PostgreSQL options=topology=YES |
| 65 | # create random points map |
| 66 | v.random out=test_points n=1000 |
| 67 | # access created external data |
| 68 | v.info test_points |
| 69 | ... |
| 70 | |----------------------------------------------------------------------------| |
| 71 | | Map format: PostGIS (PostgreSQL) | |
| 72 | | DB table: public.test_points | |
| 73 | | DB name: grass | |
| 74 | | Geometry column: geom | |
| 75 | | Feature type: point | |
| 76 | | Topology: pseudo (simple features) | |
| 77 | |----------------------------------------------------------------------------| |
| 78 | ... |
| 79 | }}} |
| 80 | |
| 81 | For more examples see [http://grasswiki.osgeo.org/wiki/PostGIS wiki page] from GRASS Wiki. |
| 82 | |
| 83 | == Topological access == |
| 84 | |
| 85 | '''Export GRASS vector data to PostGIS as topological elements:''' |
| 86 | |
| 87 | {{{ |
| 88 | v.out.postgis -l input=urbanarea dsn=PG:dbname=grass |
| 89 | }}} |
| 90 | |
| 91 | '''Read example:''' |
| 92 | |
| 93 | {{{ |
| 94 | # create a link to PostGIS table |
| 95 | v.external dsn=PG:dbname=grass layer=urbanarea |
| 96 | # access data as normal vector map in GRASS |
| 97 | v.info map=urbanarea |
| 98 | ... |
| 99 | |----------------------------------------------------------------------------| |
| 100 | | Map format: PostGIS (PostgreSQL) | |
| 101 | | DB table: public.urbanarea | |
| 102 | | DB name: grass | |
| 103 | | Geometry column: geom | |
| 104 | | Feature type: polygon | |
| 105 | | Topology: PostGIS (schema: topo_urbanarea) | |
| 106 | | Topology column: topo | |