DESCRIPTION

v.external creates new vector map as a link to external OGR layer or PostGIS feature table. OGR (Simple Features Library) is part of the GDAL library, so you need to install GDAL to use v.external for external OGR layers. Note that a PostGIS feature table can be linked also using built-in GRASS-PostGIS data driver (requires GRASS to be built with PostgreSQL support).

Supported OGR vector formats

To list supported OGR formats, type
v.external -f
For details see OGR web site.

EXAMPLES

ESRI Shapefile

Assuming that 'test_shape.shp' is located in directory '/home/user/shape_data'.
v.external dsn=/home/user/shape_data layer=test_shape output=grass_map 

MapInfo files

v.external dsn=./ layer=mapinfo_test output=grass_map

SDTS files

Note: you have to select the CATD file
v.external dsn=CITXCATD.DDF output=cities

TIGER files

v.external dsn=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all

PostGIS layers

PostGIS links are by default created by built-in PostGIS support, ie. using GRASS-PostGIS data driver. If the environment variable GRASS_VECTOR_OGR exists, or GRASS is compiled without PostgreSQL support then GRASS will use OGR-PostgreSQL driver for creating a link.
v.external dsn="PG:host=localhost user=postgres dbname=postgis" layer=polymap

NOTES

The simple feature data model used by OGR (or PostGIS) is very different from the topological format used by GRASS. Instead of true topology, so called 'pseudo topology' is created for data linked by v.external. User should learn the difference between those two formats, because some modules working correctly with GRASS native data, can produce wrong results with input vector maps created by v.external.

See v.db.connect for an example of maintaining attributes in external DBMS in also writable mode.

REFERENCES

OGR vector library C API documentation

SEE ALSO

v.external.out, v.clean, v.db.connect, v.in.db, v.in.ogr, v.out.ogr

OGR Library
PostGIS

See also GRASS user wiki page for more examples.

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy
PostGIS support by Martin Landa, Czech Technical University in Prague, Czech Republic

Last changed: $Date$