1v.external(1) Grass User's Manual v.external(1)
2
3
4
6 v.external - Creates a new pseudo-vector map as a link to an OGR-sup‐
7 ported layer or a PostGIS feature table.
8
10 vector, import, external, OGR, PostGIS, level1
11
13 v.external
14 v.external --help
15 v.external [-ojfltb] input=string [layer=name] [where=sql_query]
16 [output=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 -o
20 Override projection check (use current location’s projection)
21 Assume that the dataset has the same projection as the current
22 location
23
24 -j
25 Perform projection check only and exit
26
27 -f
28 List supported formats and exit
29
30 -l
31 List available layers in data source and exit
32
33 -t
34 List available layers including feature type in data source and
35 exit
36 Format: layer name,type,projection check,geometry
37
38 -b
39 Do not build topology
40 Advantageous when handling a large number of points
41
42 --overwrite
43 Allow output files to overwrite existing files
44
45 --help
46 Print usage summary
47
48 --verbose
49 Verbose module output
50
51 --quiet
52 Quiet module output
53
54 --ui
55 Force launching GUI dialog
56
57 Parameters:
58 input=string [required]
59 Name of input OGR or PostGIS data source
60 Examples:
61 ESRI Shapefile: directory containing a shapefile
62 MapInfo File: directory containing a mapinfo file
63 PostGIS database: connection string, eg. ’PG:dbname=db user=grass’
64
65 layer=name
66 Name of OGR layer or PostGIS feature table to be linked
67 Examples:
68 ESRI Shapefile: shapefile name
69 MapInfo File: mapinfo file name
70 PostGIS database: table name
71
72 where=sql_query
73 WHERE conditions of SQL statement without ’where’ keyword
74 Example: income < 1000 and population >= 10000
75
76 output=name
77 Name for output GRASS vector map (default: input layer)
78
80 v.external creates new vector map as a link to external OGR layer or
81 PostGIS feature table. OGR (Simple Features Library) is part of the
82 GDAL library, so you need to install GDAL to use v.external for exter‐
83 nal OGR layers. Note that a PostGIS feature table can be linked also
84 using built-in GRASS-PostGIS data driver (requires GRASS to be built
85 with PostgreSQL support).
86
88 The simple feature data model used by OGR (or PostGIS) is very differ‐
89 ent from the topological format used by GRASS. Instead of true topol‐
90 ogy, so called ’pseudo topology’ is created for data linked by v.exter‐
91 nal. User should learn the difference between those two formats,
92 because some modules working correctly with GRASS native data, can pro‐
93 duce wrong results with input vector maps created by v.external.
94
95 Limitations:
96
97 Due to these data model differences v.external does not work with all
98 data formats. In general, for all formats that do not have a key column
99 (e.g. SHAPE file), attributes are not accessible, and attributes would
100 get lost when modifying the geometries. Therefore it is generally not
101 safe to link vector data with v.external. In many cases it does not
102 make sense to use v.external linked data with simple features, instead
103 vector data should be imported with v.import or v.in.ogr to get true
104 topology support. Importantly, point cloud data which do not have
105 topology, can be linked with v.external as long as there are no
106 attributes attached to these point cloud data, or if the format of the
107 point cloud data has a key column that allows linking vector geometries
108 to attributes.
109
110 See v.db.connect for an example of maintaining attributes in external
111 DBMS in also writable mode.
112
113 Supported OGR vector formats
114 To list supported OGR formats, type
115 v.external -f
116 For details see GDAL web site.
117
119 ESRI Shapefile
120 Assuming that ’test_shape.shp’ is located in directory
121 ’/home/user/shape_data’.
122 v.external input=/home/user/shape_data layer=test_shape output=grass_map
123
124 PostGIS layers
125 By default, PostGIS links are created by built-in PostGIS support, ie.
126 using GRASS-PostGIS data driver. If the environment variable GRASS_VEC‐
127 TOR_OGR exists, or GRASS is compiled without PostgreSQL support then
128 GRASS will use OGR-PostgreSQL driver for creating a link.
129
130 List of layers for given data source can be printed by -l flag.
131 v.external input="PG:host=localhost user=postgres dbname=postgis" -l
132 ...
133 polymap
134 ...
135 v.external input="PG:host=localhost user=postgres dbname=postgis" layer=polymap
136 Note: Authentication details (user password) can be preferably defined
137 by db.login.
138
139 MapInfo files
140 Assuming that ’mapinfo_test’ MapInfo file is located in the current
141 directory (".").
142 v.external input=./ layer=mapinfo_test output=grass_map
143
144 SDTS files
145 Note: you have to select the CATD file
146 v.external input=CITXCATD.DDF output=cities
147
148 TIGER files
149 v.external input=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all
150
151 Linking subset of features
152 By where option only subset of features can be linked. In the example
153 below only one feature (in this case a vector tile) will be linked as a
154 new GRASS vector map.
155 v.external in="PG:dbname=tiles" layer=wrs2_descending where="pr=191026"
156 ...
157 Number of areas: 1
158 ...
159
161 OGR vector library C API documentation
162
164 v.external.out, v.clean, v.db.connect, v.import, v.in.db, v.in.ogr,
165 v.out.ogr
166
167 GDAL Library
168 PostGIS
169
170 See also GRASS user wiki page for more examples.
171
173 Radim Blazek, ITC-Irst, Trento, Italy
174 PostGIS support by Martin Landa, GeoForAll (OSGeoREL) Lab, Czech Tech‐
175 nical University in Prague, Czech Republic
176
177 Last changed: $Date: 2017-11-18 09:57:44 +0100 (Sat, 18 Nov 2017) $
178
180 Available at: v.external source code (history)
181
182 Main index | Vector index | Topics index | Keywords index | Graphical
183 index | Full index
184
185 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
186
187
188
189GRASS 7.4.4 v.external(1)