1v.out.ogr(1) Grass User's Manual v.out.ogr(1)
2
3
4
6 v.out.ogr - Exports a vector map layer to any of the supported OGR
7 vector formats.
8 By default a vector map layer is exported to OGC GeoPackage format.
9
11 vector, export, OGR
12
14 v.out.ogr
15 v.out.ogr --help
16 v.out.ogr [-uasce2mnl] input=name [layer=string]
17 [type=string[,string,...]] output=name format=string [out‐
18 put_layer=string] [output_type=string[,string,...]]
19 [dsco=string[,string,...]] [lco=string[,string,...]] [--overwrite]
20 [--help] [--verbose] [--quiet] [--ui]
21
22 Flags:
23 -u
24 Open an existing OGR datasource for update
25
26 -a
27 Append to existing layer
28 A new OGR layer is created if it does not exist
29
30 -s
31 Skip export of GRASS category ID (’cat’) attribute
32
33 -c
34 Also export features without category (not labeled). Otherwise only
35 features with category are exported.
36
37 -e
38 Use ESRI-style .prj file format (applies to Shapefile output only)
39
40 -2
41 Force 2D output even if input is 3D (applies to Shapefile output
42 only)
43 Useful if input is 3D but all z coordinates are identical
44
45 -m
46 Export vector data as multi-features
47
48 -n
49 Create a new empty layer in defined OGR datasource and exit. Noth‐
50 ing is read from input.
51
52 -l
53 List supported output formats and exit
54
55 --overwrite
56 Allow output files to overwrite existing files
57
58 --help
59 Print usage summary
60
61 --verbose
62 Verbose module output
63
64 --quiet
65 Quiet module output
66
67 --ui
68 Force launching GUI dialog
69
70 Parameters:
71 input=name [required]
72 Name of input vector map to export
73 Or data source for direct OGR access
74
75 layer=string
76 Layer number or name
77 Vector features can have category values in different layers. This
78 number determines which layer to use. When used with direct OGR
79 access this is the layer name.
80 Default: 1
81
82 type=string[,string,...]
83 Feature type(s)
84 Combination of types is not supported by all output formats.
85 Default is to use first type found in input vector map.
86 Options: point, line, boundary, centroid, area, face, kernel, auto
87 Default: auto
88
89 output=name [required]
90 Name of output OGR datasource
91 For example: ESRI Shapefile: filename or directory for storage
92 PostGIS database: connection string
93
94 format=string [required]
95 Data format to write
96 Options: AmigoCloud, BNA, CSV, Carto, Cloudant, CouchDB, DGN, DXF,
97 ESRI_Shapefile, ElasticSearch, GFT, GML, GMLAS, GPKG, GPSBabel,
98 GPSTrackMaker, GPX, GeoJSON, GeoRSS, Geoconcept, Interlis_1,
99 Interlis_2, JML, JP2OpenJPEG, JPEG2000, KML, LIBKML, MBTiles,
100 MSSQLSpatial, MVT, MapInfo_File, Memory, MySQL, ODBC, ODS, OGR_GMT,
101 PCIDSK, PDF, PGDUMP, PostgreSQL, S57, SQLite, Selafin, TIGER, VDV,
102 WAsP, XLSX, netCDF
103 Default: GPKG
104
105 output_layer=string
106 Name for output OGR layer. If not specified, input name is used
107 For example: ESRI Shapefile: shapefile name
108 PostGIS database: table name
109
110 output_type=string[,string,...]
111 Optionally change default output type
112 Options: line, boundary
113 Default:
114 line: export area boundaries as linestrings
115 boundary: export lines as polygons
116
117 dsco=string[,string,...]
118 OGR dataset creation option (format specific, NAME=VALUE)
119 Default:
120
121 lco=string[,string,...]
122 OGR layer creation option (format specific, NAME=VALUE)
123 Default:
124
126 v.out.ogr converts GRASS vector map layer to any of the supported OGR
127 vector formats (including OGC GeoPackage, ESRI Shapefile, SpatiaLite or
128 GML).
129
130 OGR (Simple Features Library) is part of the GDAL library, so you need
131 to install this library to use v.out.ogr.
132
133 The OGR library supports many various formats including:
134
135 · OGC GeoPackage
136
137 · ESRI Shapefile
138
139 · PostGIS
140
141 · SpatiaLite
142
143 · CSV
144
145 · GML
146
147 · KML
148
149 · Mapinfo File
150
151 · TIGER
152
153 · ... and many others
154 The list of supported formats is printed with the -l flag.
155
156 For further available other supported formats go here.
157
159 By default, islands will appear as holes inside surrounding areas. To
160 export polygons with holes into, e.g., a Esri Shapefile, and make the
161 holes appear as filled areas, the flag -c has to be used.
162
163 v.out.ogr exports 3D vector data as 2.5D simple features if possible
164 (not supported by all formats). For exporting 3D vector data as 2D sim‐
165 ple features, use -2 flag.
166
167 By default, v.out.ogr converts GRASS vector data to single simple fea‐
168 tures. If GRASS feature has more categories defined in the given layer,
169 then this feature is exported multiple times. GRASS features without
170 category are skipped by default. To export features also without cate‐
171 gory, the -c flag must be given.
172
173 When -m flag is given, v.out.ogr export GRASS vector data as multi-fea‐
174 tures. Multi-feature is formed by GRASS features with the same cate‐
175 gory. When -c flag is given, the module also export GRASS features
176 without category as one multi-feature. Note that multi-features are not
177 supported by all formats.
178
179 ESRI Shapefile export: note that due to the DBF table specifications
180 column names may not be longer than 10 characters.
181
183 Export to OGC GeoPackage
184 Export lines from a GRASS vector map to OGC GeoPackage format:
185 v.out.ogr input=roadsmajor type=line output=roadsmajor.gpkg
186
187 Export areas from GRASS vector map to OGC GeoPackage format, converting
188 islands (holes) to filled polygons:
189 v.out.ogr -c input=areas_islands type=area output=areas_islands.gpkg
190
191 Export mixed geometry type GRASS vector map to OGC GeoPackage format:
192 v.out.ogr input=generic_vector output=mixed_geometry.gpkg
193
194 Export to ESRI Shapefile
195 Export lines from GRASS vector map to Shapefile format:
196 v.out.ogr input=roadsmajor type=line format=ESRI_Shapefile output=lines.shp
197
198 Export areas from GRASS vector map to Shapefile format, converting
199 islands (holes) to filled polygons:
200 v.out.ogr -c input=areas_islands type=area format=ESRI_Shapefile output=areas_islands.shp
201
202 Export 3D lines from GRASS vector map to Shapefile format:
203 v.out.ogr input=lines_3d type=line format=ESRI_Shapefile output=lines_3d.shp lco="SHPT=ARCZ"
204
205 Export 3D points (e.g., Lidar points) from GRASS vector map to Shape‐
206 file format
207 v.out.ogr points_3d type=point format=ESRI_Shapefile output=points_3d.shp lco="SHPT=POINTZ"
208
209 Export 3D faces from GRASS vector map to Shapefile format:
210 v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp lco="SHPT=POLYGONZ"
211
212 Export 3D faces from GRASS vector map to Shapefile format, automatic 3D
213 setting:
214 v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp"
215
216 Export to GML
217 Export lines from GRASS vector map to GML format (generates
218 ’/tmp/testogr.gml’ file with layer ’testogr’):
219 v.out.ogr input=multi type=line output=/tmp/testogr.gml output_layer=testogr format=GML
220
221 Export to PostgreSQL/PostGIS
222 Export areas from GRASS vector map to PostGIS database:
223 v.out.ogr input=polygons type=area output="PG:host=localhost dbname=postgis user=postgres" output_layer=polymap format=PostgreSQL
224 Note: For exporting GRASS vector data to PostGIS database can be also
225 used v.out.postgis module. This module is not based on OGR library and
226 supports beside simple features also topological format (PostGIS Topol‐
227 ogy).
228
229 Export to KML (Google Earth)
230 Export faces (3D vectors) from GRASS vector map to KML format for
231 Google Earth:
232 v.out.ogr input=buildings_3d output=buildings_3d.kml output_layer=buildings_3d format=KML type=face
233
234 Generate and export GRASS vector "asteroid" map (faces, 3D vectors) to
235 KML format for Google Earth:
236 # near Raleigh (NC, USA)
237 g.region n=35.73952587 s=35.73279182 w=-78.68263928 e=-78.67499517
238 # two layers of random points
239 v.random -z output=random3d_a n=10 zmin=0 zmax=200
240 v.random -z output=random3d_b n=15 zmin=400 zmax=600
241 # merge into one 3D points map
242 v.patch input=random3d_a,random3d_b output=random3d
243 # generate 3D convex hull
244 v.hull input=random3d output="random3d_hull"
245 # export to KML 3D
246 v.out.ogr input=random3d_hull output=random3d_hull.kml format=KML type=face dsco="AltitudeMode=absolute"
247 # now open KML file ’random3d_hull.kml’ in Google Earth or NASA WorldWind or ...
248
250 · OGR vector library
251
252 · OGR vector library C API documentation
253
255 v.out.postgis, db.out.ogr, v.external, v.external.out, v.in.ogr,
256 v.pack
257
259 Radim Blazek, ITC-Irst, Trento, Italy
260 Some contributions: Markus Neteler
261 Multi-feature support by Martin Landa, Czech Technical University in
262 Prague, 2013
263
264 Last changed: $Date: 2017-10-25 23:32:54 +0200 (Wed, 25 Oct 2017) $
265
267 Available at: v.out.ogr source code (history)
268
269 Main index | Vector index | Topics index | Keywords index | Graphical
270 index | Full index
271
272 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
273
274
275
276GRASS 7.4.4 v.out.ogr(1)