v.in.ogr(1)

NAME
v.in.ogr - Convert OGR vectors to GRASS. Available drivers: ESRI Shapefile,UK .NTF,SDTS,TIGER,S57,MapInfo File,DGN,VRT,AVCBin,REC,Memory,CSV,GML

SYNOPSIS
v.in.ogr
v.in.ogr help
v.in.ogr [-lfcztoe] dsn=string output=string [layer=string[,string,...]] [spatial=float[,float,...]] [min_area=float] [type=string[,string,...]] [snap=float] [location=string] [cnames=string[,string,...]]

  Flags:

-l  List available layers in data source and exit.

-f  List available formats and exit.

-c  Do not clean polygons.

-z  Create 3D output.

-t  Do not create attribute table.

-o  Override projection (use location's projection).

-e  Extend location extents based on new dataset.

  Parameters:

dsn=string
    OGR datasource name.
        ESRI Shapefile: directory containing shapefiles    MapInfo File: directory containing mapinfo files

output=string
    Name of output vector

layer=string[,string,...]
    OGR layer name. If not given, all available layers are imported.
        ESRI Shapefile: shapefile name    MapInfo File: mapinfo file name

spatial=float[,float,...]
    Import subregion only (xmin,ymin,xmax,ymax - usually W,S,E,N)

min_area=float
    Minimum size of area to be imported (square units). Smaller areas and islands are ignored. Should be greater than snap^2. Default: 0.0001

type=string[,string,...]
    Optionaly change default input type:
         point -> import area centroids as points     line -> import area boundaries as centroids     boundary -> import lines as area boundaries     centroid -> import points as centroids
    Options: point,line,boundary,centroid Default:

snap=float
    Snapping threshold for boundaries. -1 for no snap. Default: -1

location=string
    Name for new location to create

cnames=string[,string,...]
    List of column names to be used instead of original names, first is used for category column.

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:

        SHAPE files
        v.in.ogr dsn=/home/user/shape_data layer=test_shape output=grass_map

        MapInfo files
        v.in.ogr dsn=./ layer=mapinfo_test output=grass_map

        Arc Coverage
        We import the Arcs and Label points, the module takes care to build areas:
        v.in.ogr dsn=gemeinden layer=LAB,ARC type=centroid,boundary output=mymap

        E00 file
        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

        SDTS files (you have to select the CATD file)
        v.in.ogr dsn=CITXCATD.DDF output=cities

        TIGER files
        v.in.ogr dsn=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all type=boundary,centroid snap=-1

        PostGIS maps (area example)
        v.in.ogr dsn="PG:host=localhost dbname=postgis user=postgres" layer=polymap output=polygons type=boundary,centroid

    Support of database schema:

    First v.database has to be used to set a default schema for the new vector table(s). In db.* modules the schema name must be always specified if used. Example:
        v.database driver=pg database=test schema=user1
        v.in.ogr dsn=./ layer=river output=river # -> table user1.river
        db.select table=user1.river
    The user can ignore schemas, if desired:
         v.database driver=pg database=test
         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_]*
That 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.

REFERENCES
OGR vector library
OGR vector library C API documentation

SEE ALSO
v.clean, v.database, v.db.connect, v.external, v.out.ogr

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

Last changed: $Date: 2005/04/29 07:32:12 $

Help Index