If the layer parameter is not given, all available layers are imported as separate GRASS layers into one GRASS vector map. If several OGR layer names are given, all these layers are imported as separate GRASS layers into one GRASS vector map.
The optional spatial parameter defines spatial query extents. This parameter allows the user to restrict the region to a spatial subset while importing the data. All vector features completely or partially falling into this rectangle subregion are imported. The -r current region flag is identical, but uses the current region settings as the spatial bounds (see g.region).
Topology cleaning on areas is automatically performed, but may fail in special cases (then use v.clean).
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.
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.
v.in.ogr dsn=/home/user/shape_data/test_shape.shp output=grass_map
v.in.ogr dsn=/home/user/shape_data layer=test_shape output=grass_map
v.in.ogr dsn=./ layer=mapinfo_test output=grass_map
v.in.ogr dsn=gemeinden layer=LAB,ARC type=centroid,boundary output=mymap
avcimport e00file coverage v.in.ogr dsn=coverage layer=LAB,ARC type=centroid,boundary output=mymap
v.in.ogr dsn=CITXCATD.DDF output=cities
v.in.ogr dsn=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all \ type=boundary,centroid snap=-1
v.in.ogr dsn="PG:host=localhost dbname=postgis user=postgres" layer=polymap \ output=polygons type=boundary,centroid
v.in.ogr dsn=OCI:username/password@database_instance output=grasslayer layer=roads_oci
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
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
[A-Za-z][A-Za-z0-9_]*
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 and modify the list given with the error message). Alternatively, change the local DB with db.connect.
"ERROR: Projection of dataset does not appear to match the current location."
You need to create a location whose projection matches the data you
wish to import. Try using location parameter to create a new location based
upon the projection information in the file. If desired, you can then re-project
it to another location with v.proj.
Last changed: $Date$