## NAME

v.import - Imports vector data into a GRASS vector map using OGR library and reprojects on the fly.

## KEYWORDS

vector, import, projection

## SYNOPSIS

v.import
v.import --help
v.import [-flo] input=string [layer=string[,string,...]] [output=name] [extent=string] [encoding=string] [snap=float] [epsg=integer] [datum_trans=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

### Flags:

-f
  List supported OGR formats and exit
-l
  List available OGR layers in data source and exit
-o
  Override projection check (use current location's projection)
  Assume that the dataset has the same projection as the current location
--overwrite
  Allow output files to overwrite existing files
--help
  Print usage summary
--verbose
  Verbose module output
--quiet
  Quiet module output
--ui
  Force launching GUI dialog

### Parameters:

input=string [required]
  Name of OGR datasource to be imported
layer=string[,string,...]
  OGR layer name. If not given, all available layers are imported
output=name
  Name for output vector map (default: input)
extent=string
  Output vector map extent
  Options: input, region
  Default: input
  input: extent of input map
  region: extent of current region
encoding=string
  Encoding value for attribute data
snap=float
  Snapping threshold for boundaries (map units)
  A suitable threshold is estimated during import
  Default: -1
epsg=integer
  EPSG projection code
  Options: 1-1000000
datum_trans=integer
  Index number of datum transform parameters
  -1 to list available datum transform parameters
  Options: -1-100

## DESCRIPTION

v.import imports vector data from files and database connections supported by the OGR library) into the current location and mapset. If the projection of the input does not match the projection of the location, the input is reprojected into the current location. In case that the projection of the input map does match the projection of the location, the input is imported directly.

### Supported Vector Formats

v.import uses the OGR library which supports various vector data formats including ESRI Shapefile, Mapinfo File, UK .NTF, SDTS, TIGER, IHO S-57 (ENC), DGN, GML, GPX, AVCBin, REC, Memory, OGDI, and PostgreSQL, depending on the local OGR installation. For details see the OGR web site. The OGR (Simple Features Library) is part of the GDAL library, hence GDAL needs to be installed to use v.in.ogr.

The list of actually supported formats can be printed by -f flag.

## NOTES

v.import checks the projection metadata of the dataset to be imported against the current location's projection. If not identical a related error message is shown.
To override this projection check (i.e. to use current location's projection) by assuming that the dataset has the same projection as the current location the -o flag can be used. This is also useful when geodata to be imported do not contain any projection metadata at all. The user must be sure that the projection is identical in order to avoid to introduce data errors.

### Topology cleaning

When importing polygons, non-topological polygons are converted to topological areas. If the input polygons contain errors (unexpected overlapping areas, small gaps between polygons, or warnings about being unable to calculate centroids), the import might need to be repeated using a snap value as suggested in the output messages.

The snap threshold defines the maximal distance from one to another vertex in map units (for latitude-longitude locations in degree). If there is no other vertex within snap distance, no snapping will be done. Note that a too large value can severely damage area topology, beyond repair.

Post-processing: Snapped boundaries may need to be cleaned with v.clean, using its tools break,rmdupl,rmsa. For details, refer to the v.clean manual page.

## EXAMPLE

    # import SHAPE file at full extent and reproject to current location projection
    v.import input=research_area.shp output=research_area extent=input

## ERROR MESSAGES

### SQL syntax errors

Depending on the currently selected SQL driver, error messages such as follows may arise:

    DBMI-SQLite driver error:
    Error in sqlite3_prepare():
    near "ORDER": syntax error

Or:

    DBMI-DBF driver error:
    SQL parser error:
    syntax error, unexpected DESC, expecting NAME processing 'DESC

This indicates that a column name in the input dataset corresponds to a reserved SQL word (here: 'ORDER' and 'DESC' respectively). A different column name has to be used in this case. The columns parameter can be used to assign different column names on the fly in order to avoid using reserved SQL words. For a list of SQL reserved words for SQLite (the default driver), see here.

### Projection errors

    Projection of dataset does not appear to match the current location.

Here you need to create or use a location whose projection matches that of the vector 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.

## SEE ALSO

v.clean, v.in.ogr, v.proj

## AUTHORS

Markus Metz
Improvements: Martin Landa, Anna Petrasova

Last changed: $Date$

## SOURCE CODE

Available at: v.import source code (history)

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2019 GRASS Development Team, GRASS GIS 7.8.0 Reference Manual