If the layer parameter is not given, all available OGR 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).
The min_area threshold value is being specified as area size in map units with the exception of latitude-longitude locations in which it is being specified solely in square meters.
The snap threshold value is used to snap boundary vertices to each other if the distance in map units between two vertices is not larger than the threshold. Snapping is by default disabled with -1. See also the v.clean manual.
List of locally supported formats can be printed by -f flag.
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.
[A-Za-z][A-Za-z0-9_]*
v.in.ogr converts '.', '-' and '#' to '_' (underscore) during import. The -w flag changes capital column names to lowercase characters as a convenience for SQL usage (lowercase column names avoid the need to quote them if the attribute table is stored in a SQL DBMS such as PostgreSQL). The cnames parameter is used 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 and modify the list given with the error message). Alternatively, change the local DB with db.connect.
When importing Esri Shapefiles the OGR library tries to read the LDID/codepage setting from the .dbf file and use it to translate string fields to UTF-8. LDID "87 / 0x57" is treated as ISO8859_1 which may not be appropriate for many languages. Unfortunately it is not clear what other values may be appropriate (see example bellow). To change encoding the user can set up SHAPE_ENCODING environmental variable or simply to define encoding value using encoding parameter. Note that recoding support is new for GDAL/OGR 1.9.0.
Value for encoding also affects text recoding when importing DXF files. For other formats has encoding value no effect.
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=/home/user/shape_data/test_shape.shp output=grass_map encoding=cp1250
v.in.ogr dsn=./ layer=mapinfo_test output=grass_map
v.in.ogr dsn=gemeinden layer=LAB,ARC type=centroid,boundary output=mymap
First we have to convert the E00 file to an Arc Coverage with 'avcimport' (AVCE00 tools, use e00conv first in case that avcimport fails):
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
Last changed: $Date$