1v.out.ogr(1)                GRASS GIS User's Manual               v.out.ogr(1)
2
3
4

NAME

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

KEYWORDS

11       vector, export, output, OGR, output
12

SYNOPSIS

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 ac‐
79           cess 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. De‐
85           fault 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, BAG, BNA, CSV, Carto, Cloudant, CouchDB,  DGN,
97           DXF,  ESRI_Shapefile,  Elasticsearch, FITS, FlatGeobuf, GML, GMLAS,
98           GPKG, GPSBabel, GPSTrackMaker, GPX,  GeoJSON,  GeoJSONSeq,  GeoRSS,
99           Geoconcept,  Interlis_1,  Interlis_2,  JML,  JP2OpenJPEG, JPEG2000,
100           KML, LIBKML, MBTiles, MSSQLSpatial, MVT, MapInfo_File, MapML,  Mem‐
101           ory,  MySQL,  NGW,  ODBC,  ODS, OGR_GMT, PCIDSK, PDF, PDS4, PGDUMP,
102           PostgreSQL, S57, SQLite, Selafin, TIGER, VDV,  VICAR,  WAsP,  XLSX,
103           netCDF
104           Default: GPKG
105
106       output_layer=string
107           Name for output OGR layer. If not specified, input name is used
108           For example: ESRI Shapefile: shapefile name
109                       PostGIS database: table name
110
111       output_type=string[,string,...]
112           Optionally change default output type
113           Options: line, boundary
114           Default:
115           line: export area boundaries as linestrings
116           boundary: export lines as polygons
117
118       dsco=string[,string,...]
119           OGR dataset creation option (format specific, NAME=VALUE)
120           Default:
121
122       lco=string[,string,...]
123           OGR layer creation option (format specific, NAME=VALUE)
124           Default:
125

DESCRIPTION

127       v.out.ogr  converts  GRASS vector map layer to any of the supported OGR
128       vector formats (including OGC GeoPackage, ESRI Shapefile, SpatiaLite or
129       GML).
130
131       OGR  (Simple Features Library) is part of the GDAL library, so you need
132       to install this library to use v.out.ogr.
133
134       The OGR library supports many various formats including:
135
136           •   OGC GeoPackage
137
138           •   ESRI Shapefile
139
140           •   PostGIS
141
142           •   SpatiaLite
143
144           •   CSV
145
146           •   GML
147
148           •   KML
149
150           •   Mapinfo File
151
152           •   TIGER
153
154           •   ... and many others
155       The list of supported formats is printed with the -l flag.
156
157       For further available other supported formats go here.
158

NOTES

160       By default, islands will appear as holes inside surrounding  areas.  To
161       export  polygons  with holes into, e.g., a Esri Shapefile, and make the
162       holes appear as filled areas, the flag -c has to be used.
163
164       v.out.ogr exports 3D vector data as 2.5D simple  features  if  possible
165       (not supported by all formats). For exporting 3D vector data as 2D sim‐
166       ple features, use -2 flag.
167
168       By default, v.out.ogr converts GRASS vector data to single simple  fea‐
169       tures. If GRASS feature has more categories defined in the given layer,
170       then this feature is exported multiple times.  GRASS  features  without
171       category  are skipped by default. To export features also without cate‐
172       gory, the -c flag must be given.
173
174       When -m flag is given, v.out.ogr export GRASS vector data as multi-fea‐
175       tures.  Multi-feature  is  formed by GRASS features with the same cate‐
176       gory. When -c flag is given, the  module  also  export  GRASS  features
177       without category as one multi-feature. Note that multi-features are not
178       supported by all formats.
179
180       ESRI Shapefile export: note that due to the  DBF  table  specifications
181       column names may not be longer than 10 characters.
182
183       Performance:  export  to  SQLite based formats including OGC GeoPackage
184       may become faster with the environmental variable OGR_SQLITE_CACHE=1024
185       being set (value depends on available RAM, see OGR ConfigOptions).
186

EXAMPLES

188   Export to OGC GeoPackage
189       Export lines from a GRASS vector map to OGC GeoPackage format:
190       v.out.ogr input=roadsmajor type=line output=roadsmajor.gpkg
191
192       Export areas from GRASS vector map to OGC GeoPackage format, converting
193       islands (holes) to filled polygons:
194       v.out.ogr -c input=areas_islands type=area output=areas_islands.gpkg
195
196       Export mixed geometry type GRASS vector map to OGC GeoPackage format:
197       v.out.ogr input=generic_vector output=mixed_geometry.gpkg
198
199   Export to ESRI Shapefile
200       Export lines from GRASS vector map to Shapefile format:
201       v.out.ogr input=roadsmajor type=line format=ESRI_Shapefile output=lines.shp
202
203       Export areas from GRASS vector map to Shapefile format, converting  is‐
204       lands (holes) to filled polygons:
205       v.out.ogr -c input=areas_islands type=area format=ESRI_Shapefile output=areas_islands.shp
206
207       Export 3D lines from GRASS vector map to Shapefile format:
208       v.out.ogr input=lines_3d type=line format=ESRI_Shapefile output=lines_3d.shp lco="SHPT=ARCZ"
209
210       Export  3D  points (e.g., Lidar points) from GRASS vector map to Shape‐
211       file format
212       v.out.ogr points_3d type=point format=ESRI_Shapefile output=points_3d.shp lco="SHPT=POINTZ"
213
214       Export 3D faces from GRASS vector map to Shapefile format:
215       v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp lco="SHPT=POLYGONZ"
216
217       Export 3D faces from GRASS vector map to Shapefile format, automatic 3D
218       setting:
219       v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp"
220
221   Export to GML
222       Export   lines   from   GRASS  vector  map  to  GML  format  (generates
223       ’/tmp/testogr.gml’ file with layer ’testogr’):
224       v.out.ogr input=multi type=line output=/tmp/testogr.gml output_layer=testogr format=GML
225
226   Export to PostgreSQL/PostGIS
227       Export areas from GRASS vector map to PostGIS database:
228       v.out.ogr input=polygons type=area output="PG:host=localhost dbname=postgis user=postgres" output_layer=polymap format=PostgreSQL
229       Note: For exporting GRASS vector data to PostGIS database can  be  also
230       used  v.out.postgis module. This module is not based on OGR library and
231       supports beside simple features also topological format (PostGIS Topol‐
232       ogy).
233
234   Export to KML (Google Earth)
235       Export  faces  (3D  vectors)  from  GRASS  vector map to KML format for
236       Google Earth:
237       v.out.ogr input=buildings_3d output=buildings_3d.kml output_layer=buildings_3d format=KML type=face
238
239       Generate and export GRASS vector "asteroid" map (faces, 3D vectors)  to
240       KML format for Google Earth:
241       # near Raleigh (NC, USA)
242       g.region n=35.73952587 s=35.73279182 w=-78.68263928 e=-78.67499517
243       # two layers of random points
244       v.random -z output=random3d_a n=10 zmin=0 zmax=200
245       v.random -z output=random3d_b n=15 zmin=400 zmax=600
246       # merge into one 3D points map
247       v.patch input=random3d_a,random3d_b output=random3d
248       # generate 3D convex hull
249       v.hull input=random3d output="random3d_hull"
250       # export to KML 3D
251       v.out.ogr input=random3d_hull output=random3d_hull.kml format=KML type=face dsco="AltitudeMode=absolute"
252       # now open KML file ’random3d_hull.kml’ in Google Earth or NASA WorldWind or ...
253

REFERENCES

255           •   OGR vector library
256
257           •   OGR vector library C API documentation
258

SEE ALSO

260          v.out.postgis,  db.out.ogr,  v.external,  v.external.out,  v.in.ogr,
261       v.pack
262

AUTHORS

264       Radim Blazek, ITC-Irst, Trento, Italy
265       Some contributions: Markus Neteler
266       Multi-feature support by Martin Landa, Czech  Technical  University  in
267       Prague, 2013
268

SOURCE CODE

270       Available at: v.out.ogr source code (history)
271
272       Main  index  | Vector index | Topics index | Keywords index | Graphical
273       index | Full index
274
275       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
276
277
278
279GRASS 7.8.5                                                       v.out.ogr(1)
Impressum