DESCRIPTION

v.in.ogr converts OGR vectors to GRASS. OGR (Simple Features Library) is part of the GDAL library, so you need to install GDAL to use v.in.ogr.

If the layer parameter is not given, all available layers are imported.

The optional spatial parameter defines spatial query extents. This parameter allows to restrict the region to a spatial subset while importing the data. All vector completely or partially falling into this rectangle subregion are imported.

Topology cleaning on areas is automatically performed, but may fail in special cases (then use v.clean).

Supported OGR Vector Formats

ESRI Shapefile
Mapinfo File

Further available drivers such as UK .NTF, SDTS, TIGER, IHO S-57 (ENC), DGN, GML, AVCBin, REC, Memory, OGDI, and PostgreSQL depend on the local installation (OGR library), for details see OGR web site.

Location Creation

v.in.ogr attempts to preserve projection information when importing datasets if the source format includes projection information, and if the OGR driver supports it. If the projection of the source dataset does not match the projection of the current location v.in.ogr will report an error message ("Projection of dataset does not appear to match current location") and then report the PROJ_INFO parameters of the source dataset.

If the user wishes to ignore the difference between the apparent coordinate system of the source data and the current location, they may pass the -o flag to override the projection check.

If the user wishes to import the data with the full projection definition, it is possible to have v.in.ogr automatically create a new location based on the projection and extents of the file being read. This is accomplished by passing the name to be used for the new location via the location parameter. Upon completion of the command, a new location will have been created (with only a PERMANENT mapset), and the vector map will have been imported with the indicated output name into the PERMANENT mapset.

EXAMPLES

The command imports various vector formats:

Support of database schema:

For schema support, first set a default schema with db.connect. If schema support is used the schema name must be specified whenever a db.* module is called.

Example:

  db.connect driver=pg database=test schema=user1 group=group1
  db.login driver=pg database=test user=user1 password=pwd1
  v.in.ogr dsn=./ layer=river output=river     # -> table user1.river
  db.select table=user1.river
  
The user can ignore schemas, if desired:
  db.connect driver=pg database=test
  db.login driver=pg database=test user=user1 password=pwd1
  v.in.ogr dsn=./ layer=river output=river     # -> table public.river
  db.select table=river
  

NOTES

The characters used for table column names are limited. Supported are:
[A-Za-z][A-Za-z0-9_]*
This means that SQL neither supports '.' (dots) nor '-' (minus) nor '#' in table column names. Also a table name must start with a character, not a number.
v.in.ogr converts '.', '-' and '#' to '_' (underscore) during import. Use the cnames parameter to define new column names during import.

The DBF database specification limits column names to 10 characters. If the default DB is set to DBF and the input data contains longer column/field names, they will be truncated. If this results in multiple columns with the same name then v.in.ogr will produce an error. In this case you will either have to modify the input data or use v.in.ogr's cnames parameter to rename columns to something unique. (hint: copy & modify the list given with the error message). Alternatively, change the local DB with db.connect.

If a message like "WARNING: Area size 1.3e-06, area not imported." appears, the min_area may be adjusted to a smaller value so that all areas are imported. Otherwise tiny areas are filtered out during import (useful to polish digitization errors or non-topological data).

REFERENCES

OGR vector library
OGR vector library C API documentation

SEE ALSO

db.connect, v.clean, v.build.polylines, v.external, v.in.e00, v.out.ogr

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy
Location and spatial extent support by Markus Neteler and Paul Kelly

Last changed: $Date$