1v.in.ogr(1)                   Grass User's Manual                  v.in.ogr(1)
2
3
4

NAME

6       v.in.ogr  - Convert OGR vector layers to GRASS vector map.
7

KEYWORDS

9       vector, import
10

SYNOPSIS

12       v.in.ogr
13       v.in.ogr help
14       v.in.ogr        [-lfcztorew]         [dsn=string]         [output=name]
15       [layer=string[,string,...]]                                       [spa‐
16       tial=xmin,ymin,xmax,ymax[,xmin,ymin,xmax,ymax,...]]   [where=sql_query]
17       [min_area=float]   [type=string[,string,...]]    [snap=float]    [loca‐
18       tion=string]    [cnames=string[,string,...]]    [--overwrite]   [--ver‐
19       bose]  [--quiet]
20
21   Flags:
22       -l
23           List available layers in data source and exit
24
25       -f
26           List supported formats and exit
27
28       -c
29           Do not clean polygons (not recommended)
30
31       -z
32           Create 3D output
33
34       -t
35           Do not create attribute table
36
37       -o
38           Override dataset projection (use location's projection)
39
40       -r
41           Limit import to the current region
42
43       -e
44           Extend location extents based on new dataset
45
46       -w
47           Change column names to lowercase characters
48
49       --overwrite
50           Allow output files to overwrite existing files
51
52       --verbose
53           Verbose module output
54
55       --quiet
56           Quiet module output
57
58   Parameters:
59       dsn=string
60           OGR datasource name
61           Examples:
62                     ESRI    Shapefile:    directory     containing     shape‐
63           files        MapInfo File: directory containing mapinfo files
64
65       output=name
66           Name for output vector map
67
68       layer=string[,string,...]
69           OGR layer name. If not given, all available layers are imported
70           Examples:
71                     ESRI  Shapefile:  shapefile  name          MapInfo  File:
72           mapinfo file name
73
74       spatial=xmin,ymin,xmax,ymax[,xmin,ymin,xmax,ymax,...]
75           Import subregion only
76           Format: xmin,ymin,xmax,ymax - usually W,S,E,N
77
78       where=sql_query
79           WHERE conditions of SQL statement without 'where' keyword
80           Example: income = 10000
81
82       min_area=float
83           Minimum size of area to be imported (square units)
84           Smaller areas and islands  are  ignored.  Should  be  greater  than
85           snap^2
86           Default: 0.0001
87
88       type=string[,string,...]
89           Type
90           Optionally change default input type
91           Options: point,line,boundary,centroid
92           Default:
93           point: import area centroids as points
94           line: import area boundaries as lines
95           boundary: import lines as area boundaries
96           centroid: import points as centroids
97
98       snap=float
99           Snapping threshold for boundaries
100           ’-1' for no snap
101           Default: -1
102
103       location=string
104           Name for new location to create
105
106       cnames=string[,string,...]
107           List of column names to be used instead of original names, first is
108           used for category column
109

DESCRIPTION

111       v.in.ogr converts OGR vectors to GRASS.  OGR (Simple Features  Library)
112       is  part  of  the  GDAL  library,  so  you  need to install GDAL to use
113       v.in.ogr.
114
115       If the layer parameter is not given, all available layers are imported.
116
117       The optional spatial parameter defines  spatial  query  extents.   This
118       parameter  allows  the  user to restrict the region to a spatial subset
119       while importing the data. All vector features completely  or  partially
120       falling  into  this  rectangle  subregion are imported.  The -r current
121       region flag is identical, but uses the current region settings  as  the
122       spatial bounds (see g.region).
123
124       Topology  cleaning on areas is automatically performed, but may fail in
125       special cases (then use v.clean).
126
127   Supported OGR Vector Formats
128       ESRI Shapefile
129       Mapinfo File
130
131       Further available drivers such as UK .NTF, SDTS, TIGER, IHO S-57 (ENC),
132       DGN, GML, AVCBin, REC, Memory, OGDI, and PostgreSQL depend on the local
133       installation (OGR library), for details see OGR web site.
134

Location Creation

136       v.in.ogr attempts to preserve  projection  information  when  importing
137       datasets  if  the source format includes projection information, and if
138       the OGR driver supports it.  If the projection of  the  source  dataset
139       does  not  match  the  projection of the current location v.in.ogr will
140       report an error message ("Projection of  dataset  does  not  appear  to
141       match  current  location")  and then report the PROJ_INFO parameters of
142       the source dataset.
143
144       If the user wishes to ignore the difference between the apparent  coor‐
145       dinate  system  of  the  source data and the current location, they may
146       pass the -o flag to override the projection check.
147
148       If the user wishes to import the data with the full projection  defini‐
149       tion,  it is possible to have v.in.ogr automatically create a new loca‐
150       tion based on the projection and extents of the file being read.   This
151       is accomplished by passing the name to be used for the new location via
152       the location parameter.  Upon completion of the command, a new location
153       will  have  been created (with only a PERMANENT mapset), and the vector
154       map will have been imported with the indicated  output  name  into  the
155       PERMANENT mapset.
156

EXAMPLES

158       The command imports various vector formats:
159
160                     SHAPE files
161                     v.in.ogr   dsn=/home/user/shape_data/test_shape.shp  out‐
162                     put=grass_map
163                      Alternate method:
164                     v.in.ogr dsn=/home/user/shape_data layer=test_shape  out‐
165                     put=grass_map
166
167
168                     MapInfo files
169                     v.in.ogr dsn=./ layer=mapinfo_test output=grass_map
170
171
172                     Arc Coverage
173                     We  import  the  Arcs  and Label points, the module takes
174                     care to build areas:
175
176                     v.in.ogr dsn=gemeinden layer=LAB,ARC type=centroid,bound‐
177                     ary output=mymap
178
179
180                     E00 file (see also v.in.e00)
181                     First  we have to convert the E00 file to an Arc Coverage
182                     with 'avcimport' (AVCE00 tools, use e00conv first in case
183                     that avcimport fails):
184
185                     avcimport e00file coverage
186                     v.in.ogr  dsn=coverage layer=LAB,ARC type=centroid,bound‐
187                     ary output=mymap
188
189
190                     SDTS files (you have to select the CATD file)
191
192                     v.in.ogr dsn=CITXCATD.DDF output=cities
193
194
195                     TIGER files
196
197                     v.in.ogr  dsn=input/2000/56015/   layer=CompleteChain,PIP
198                     output=t56015_all \
199                     type=boundary,centroid snap=-1
200
201
202                     PostGIS maps (area example)
203
204                     v.in.ogr dsn="PG:host=localhost dbname=postgis user=post‐
205                     gres" layer=polymap \
206                     output=polygons type=boundary,centroid
207
208
209                     Oracle Spatial maps
210                     Note that you have to set the environment-variables  ORA‐
211                     CLE_BASE,  ORACLE_SID,  ORACLE_HOME and TNS_ADMIN accord‐
212                     ingly.
213                     v.in.ogr dsn=OCI:username/password@database_instance out‐
214                     put=grasslayer layer=roads_oci
215
216
217   Support of database schema:
218       For  schema  support,  first  set  a default schema with db.connect. If
219       schema support is used the schema name must  be  specified  whenever  a
220       db.* module is called.
221
222       Example:
223       db.connect driver=pg database=test schema=user1 group=group1
224       db.login driver=pg database=test user=user1 password=pwd1
225       v.in.ogr dsn=./ layer=river output=river     # -> table user1.river
226       db.select table=user1.river
227        The user can ignore schemas, if desired:
228       db.connect driver=pg database=test
229       db.login driver=pg database=test user=user1 password=pwd1
230       v.in.ogr dsn=./ layer=river output=river     # -> table public.river
231       db.select table=river
232
233

NOTES

235       The characters used for table column names are limited. Supported are:
236
237       [A-Za-z][A-Za-z0-9_]*
238         This  means  that SQL neither supports '.' (dots) nor '-' (minus) nor
239       '#' in table column names. Also a table name must start with a  charac‐
240       ter, not a number.
241       v.in.ogr  converts  '.', '-' and '#' to '_' (underscore) during import.
242       The -w flag changes capital column names to lowercase characters  as  a
243       convenience  for  SQL  usage  (lowercase column names avoid the need to
244       quote them if the attribute table is stored in a SQL DBMS such as Post‐
245       greSQL).   The cnames parameter is used to define new column names dur‐
246       ing import.
247
248       The DBF database specification limits column names  to  10  characters.
249       If the default DB is set to DBF and the input data contains longer col‐
250       umn/field names, they will be truncated. If this  results  in  multiple
251       columns  with  the  same  name then v.in.ogr will produce an error.  In
252       this case you will  either  have  to  modify  the  input  data  or  use
253       v.in.ogr's  cnames  parameter  to  rename  columns to something unique.
254       (hint: copy and modify the list given with the error message).   Alter‐
255       natively, change the local DB with db.connect.
256

WARNINGS

258       If  a  message  like  "WARNING:  Area size 1.3e-06, area not imported."
259       appears, the min_area may be adjusted to a smaller value  so  that  all
260       areas are imported. Otherwise tiny areas are filtered out during import
261       (useful to polish digitization errors or non-topological data).
262

ERROR MESSAGES

264       "ERROR: DBMI-DBF driver error: SQL parser error:  syntax  error,  unex‐
265       pected DESC, expecting NAME processing 'DESC'"
266       indicates  that a column name corresponds to a reserved SQL word (here:
267       'DESC').  A different column name should be used. The cnames  parameter
268       can be used to assign different column names on the fly.
269
270       "ERROR:  Projection  of  dataset  does  not appear to match the current
271       location."
272       You need to create a location whose projection  matches  the  data  you
273       wish to import. Try using g.proj with the -c flag and the location= and
274       georef= options to create a new  location  based  upon  the  projection
275       information  in  the  file.  You should then be able to import the file
276       into that location with v.in.ogr. If desired, you can  then  re-project
277       it to another location with v.proj.
278

REFERENCES

280       OGR vector library
281       OGR vector library C API documentation
282

SEE ALSO

284         db.connect,  g.proj,  v.clean, v.build.polylines, v.edit, v.external,
285       v.in.db, v.in.e00, v.out.ogr,
286       PostGIS driver
287

AUTHOR

289       Radim Blazek, ITC-irst, Trento, Italy
290       Location and spatial extent support by Markus Neteler and Paul Kelly
291
292       Last changed: $Date: 2008-02-17 21:07:11 +0100 (Sun, 17 Feb 2008) $
293
294       Full index
295
296       © 2003-2008 GRASS Development Team
297
298
299
300GRASS 6.3.0                                                        v.in.ogr(1)
Impressum