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
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, CSV,  Carto,  DGN,  DXF,  ESRI_Shapefile,
97           Elasticsearch,  FITS,  FlatGeobuf, GML, GMLAS, GPKG, GPSBabel, GPX,
98           GeoJSON, GeoJSONSeq, GeoRSS,  Geoconcept,  Interlis_1,  Interlis_2,
99           JML,  JP2OpenJPEG,  KML,  LIBKML,  MBTiles, MSSQLSpatial, MVT, Map‐
100           Info_File, MapML, Memory, MySQL, NGW, ODS,  OGR_GMT,  PCIDSK,  PDF,
101           PDS4,  PGDUMP,  PostgreSQL, S57, SQLite, Selafin, VDV, VICAR, WAsP,
102           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

DESCRIPTION

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

NOTES

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
182       Performance: export to SQLite based formats  including  OGC  GeoPackage
183       may become faster with the environmental variable OGR_SQLITE_CACHE=1024
184       being set (value depends on available RAM, see OGR ConfigOptions).
185

EXAMPLES

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

REFERENCES

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

SEE ALSO

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

AUTHORS

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

SOURCE CODE

269       Available at: v.out.ogr source code (history)
270
271       Accessed: Saturday Jan 21 21:16:28 2023
272
273       Main index | Vector index | Topics index | Keywords index  |  Graphical
274       index | Full index
275
276       © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
277
278
279
280GRASS 8.2.1                                                       v.out.ogr(1)
Impressum