.TH v.in.ogr 1grass "" "GRASS 6.4.2" "Grass User's Manual" .SH NAME \fI\fBv.in.ogr\fR\fR - Convert OGR vector layers to GRASS vector map. .SH KEYWORDS vector, import .SH SYNOPSIS \fBv.in.ogr\fR .br \fBv.in.ogr help\fR .br \fBv.in.ogr\fR [-\fBlfcztorew\fR] [\fBdsn\fR=\fIstring\fR] [\fBoutput\fR=\fIname\fR] [\fBlayer\fR=\fIstring\fR[,\fIstring\fR,...]] [\fBspatial\fR=\fIxmin,ymin,xmax,ymax\fR[,\fIxmin,ymin,xmax,ymax\fR,...]] [\fBwhere\fR=\fIsql_query\fR] [\fBmin_area\fR=\fIfloat\fR] [\fBtype\fR=\fIstring\fR[,\fIstring\fR,...]] [\fBsnap\fR=\fIfloat\fR] [\fBlocation\fR=\fIstring\fR] [\fBcnames\fR=\fIstring\fR[,\fIstring\fR,...]] [--\fBoverwrite\fR] [--\fBverbose\fR] [--\fBquiet\fR] .SS Flags: .IP "\fB-l\fR" 4m .br List available layers in data source and exit .IP "\fB-f\fR" 4m .br List supported formats and exit .IP "\fB-c\fR" 4m .br Do not clean polygons (not recommended) .IP "\fB-z\fR" 4m .br Create 3D output .IP "\fB-t\fR" 4m .br Do not create attribute table .IP "\fB-o\fR" 4m .br Override dataset projection (use location's projection) .IP "\fB-r\fR" 4m .br Limit import to the current region .IP "\fB-e\fR" 4m .br Extend region extents based on new dataset .br Also updates the default region if in the PERMANENT mapset .IP "\fB-w\fR" 4m .br Change column names to lowercase characters .IP "\fB--overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB--verbose\fR" 4m .br Verbose module output .IP "\fB--quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBdsn\fR=\fIstring\fR" 4m .br OGR datasource name .br Examples: .br ESRI Shapefile: directory containing shapefiles MapInfo File: directory containing mapinfo files .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output vector map .IP "\fBlayer\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br OGR layer name. If not given, all available layers are imported .br Examples: .br ESRI Shapefile: shapefile name MapInfo File: mapinfo file name .IP "\fBspatial\fR=\fIxmin,ymin,xmax,ymax[,\fIxmin,ymin,xmax,ymax\fR,...]\fR" 4m .br Import subregion only .br Format: xmin,ymin,xmax,ymax - usually W,S,E,N .IP "\fBwhere\fR=\fIsql_query\fR" 4m .br WHERE conditions of SQL statement without 'where' keyword .br Example: income = 10000 .IP "\fBmin_area\fR=\fIfloat\fR" 4m .br Minimum size of area to be imported (square units) .br Smaller areas and islands are ignored. Should be greater than snap^2 .br Default: \fI0.0001\fR .IP "\fBtype\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br Optionally change default input type .br Options: \fIpoint,line,boundary,centroid\fR .br Default: \fI\fR .br \fBpoint\fR: import area centroids as points .br \fBline\fR: import area boundaries as lines .br \fBboundary\fR: import lines as area boundaries .br \fBcentroid\fR: import points as centroids .IP "\fBsnap\fR=\fIfloat\fR" 4m .br Snapping threshold for boundaries .br \(cq-1' for no snap .br Default: \fI-1\fR .IP "\fBlocation\fR=\fIstring\fR" 4m .br Name for new location to create .IP "\fBcnames\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br List of column names to be used instead of original names, first is used for category column .PP .SH DESCRIPTION \fIv.in.ogr\fR converts OGR vectors to GRASS. OGR (Simple Features Library) is part of the GDAL library, so you need to install GDAL to use \fIv.in.ogr\fR. .PP If the \fBlayer\fR 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. .PP The optional \fBspatial\fR 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 \fB-r\fR current region flag is identical, but uses the current region settings as the spatial bounds (see \fIg.region\fR). .PP Topology cleaning on areas is automatically performed, but may fail in special cases (then use v.clean). .PP The \fBmin_area\fR 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. .SS Supported OGR Vector Formats ESRI Shapefile .br Mapinfo File .PP 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. .SH Location Creation \fIv.in.ogr\fR 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 \fIv.in.ogr\fR 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. .PP 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 \fB-o\fR flag to override the projection check. .PP If the user wishes to import the data with the full projection definition, it is possible to have \fIv.in.ogr\fR 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 \fBlocation\fR 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 \fBoutput\fR name into the PERMANENT mapset. .SH EXAMPLES The command imports various vector formats: .RS .IP \fBSHAPE files\fR \fC .DS .br v.in.ogr dsn=/home/user/shape_data/test_shape.shp output=grass_map .br .DE \fR Alternate method: \fC .DS .br v.in.ogr dsn=/home/user/shape_data layer=test_shape output=grass_map .br .DE \fR .br .IP \fBMapInfo files\fR \fC .DS .br v.in.ogr dsn=./ layer=mapinfo_test output=grass_map .br .DE \fR .br .IP \fBArc Coverage\fR .br We import the Arcs and Label points, the module takes care to build areas: .br \fC .DS .br v.in.ogr dsn=gemeinden layer=LAB,ARC type=centroid,boundary output=mymap .br .DE \fR .br .IP \fBE00 file\fR (see also \fIv.in.e00\fR) .br First we have to convert the E00 file to an Arc Coverage with 'avcimport' (AVCE00 tools, use \fIe00conv\fR first in case that \fIavcimport\fR fails): .br \fC .DS .br avcimport e00file coverage .br v.in.ogr dsn=coverage layer=LAB,ARC type=centroid,boundary output=mymap .br .DE \fR .br .IP \fBSDTS files\fR (you have to select the CATD file) .br \fC .DS .br v.in.ogr dsn=CITXCATD.DDF output=cities .br .DE \fR .br .IP \fBTIGER files\fR .br \fC .DS .br v.in.ogr dsn=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all \(rs .br type=boundary,centroid snap=-1 .br .DE \fR .br .IP \fBPostGIS maps\fR (area example) .br \fC .DS .br v.in.ogr dsn="PG:host=localhost dbname=postgis user=postgres" layer=polymap \(rs .br output=polygons type=boundary,centroid .br .DE \fR .br .IP \fBOracle Spatial maps \fR .br Note that you have to set the environment-variables ORACLE_BASE, ORACLE_SID, ORACLE_HOME and TNS_ADMIN accordingly. \fC .DS .br v.in.ogr dsn=OCI:username/password@database_instance output=grasslayer layer=roads_oci .br .DE \fR .RE .SS Support of database schema: .PP For schema support, first set a default schema with \fIdb.connect\fR. If schema support is used the schema name must be specified whenever a db.* module is called. .PP Example: \fC .DS .br db.connect driver=pg database=test schema=user1 group=group1 .br db.login driver=pg database=test user=user1 password=pwd1 .br v.in.ogr dsn=./ layer=river output=river # -> table user1.river .br db.select table=user1.river .br .DE \fR The user can ignore schemas, if desired: \fC .DS .br db.connect driver=pg database=test .br db.login driver=pg database=test user=user1 password=pwd1 .br v.in.ogr dsn=./ layer=river output=river # -> table public.river .br db.select table=river .br .DE \fR .SH NOTES The characters used for table column names are limited. Supported are: .br \fC .DS .br [A-Za-z][A-Za-z0-9_]* .br .DE \fR 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. .br \fIv.in.ogr\fR converts '.', '-' and '#' to '_' (underscore) during import. The \fI-w\fR 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 \fBcnames\fR parameter is used to define new column names during import. .PP 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 \fIv.in.ogr\fR will produce an error. In this case you will either have to modify the input data or use \fIv.in.ogr\fR's \fBcnames\fR parameter to rename columns to something unique. (hint: copy and modify the list given with the error message). Alternatively, change the local DB with \fIdb.connect\fR. .SH WARNINGS If a message like "WARNING: Area size 1.3e-06, area not imported." appears, the \fBmin_area\fR 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). .SH ERROR MESSAGES \fI"ERROR: DBMI-DBF driver error: SQL parser error: syntax error, unexpected DESC, expecting NAME processing 'DESC'"\fR .br indicates that a column name corresponds to a reserved SQL word (here: 'DESC'). A different column name should be used. The \fIcnames\fR parameter can be used to assign different column names on the fly. .PP \fI"ERROR: Projection of dataset does not appear to match the current location."\fR .br You need to create a location whose projection matches the data you wish to import. Try using \fIlocation\fR 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 \fIv.proj\fR. .SH REFERENCES OGR vector library .br OGR vector library C API documentation .SH SEE ALSO \fI db.connect, v.clean, v.build.polylines, v.edit, v.external, v.in.db, v.in.e00, v.out.ogr, .br PostGIS driver \fR .SH AUTHOR Radim Blazek, ITC-irst, Trento, Italy .br Location and spatial extent support by Markus Neteler and Paul Kelly .PP \fILast changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2011 GRASS Development Team