1v.external.out(1) GRASS GIS User's Manual v.external.out(1)
2
3
4
6 v.external.out - Defines vector output format.
7
9 vector, export, output, external, OGR, PostGIS
10
12 v.external.out
13 v.external.out --help
14 v.external.out [-frpg] [output=string] [format=string] [op‐
15 tions=string[,string,...]] [loadsettings=name] [savesettings=name]
16 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 -f
20 List supported formats and exit
21
22 -r
23 Cease using OGR/PostGIS, revert to native output and exit
24
25 -p
26 Print current status
27
28 -g
29 Print current status in shell script style
30
31 --overwrite
32 Allow output files to overwrite existing files
33
34 --help
35 Print usage summary
36
37 --verbose
38 Verbose module output
39
40 --quiet
41 Quiet module output
42
43 --ui
44 Force launching GUI dialog
45
46 Parameters:
47 output=string
48 Name of output directory or OGR or PostGIS data source
49 Examples:
50 Â Â Â Â Â Â Â Â ESRI Shapefile: directory containing a shapefile
51 Â Â Â Â Â Â Â Â MapInfo File: directory containing a mapinfo file
52 Â Â Â Â Â Â Â Â PostGIS database: connection string, eg. ’PG:db‐
53 name=db user=grass’
54
55 format=string
56 Format for output vector data
57 Options: AmigoCloud, BAG, CSV, Carto, Cloudant, CouchDB, DGN, DXF,
58 ESRI_Shapefile, Elasticsearch, FITS, FlatGeobuf, GML, GPKG, GPSBa‐
59 bel, GPSTrackMaker, GPX, GeoJSON, GeoJSONSeq, GeoRSS, Geoconcept,
60 Interlis_1, Interlis_2, JML, KML, LIBKML, MBTiles, MSSQLSpatial,
61 MVT, MapInfo_File, MapML, Memory, MySQL, NGW, ODS, OGR_GMT, PCIDSK,
62 PDF, PDS4, PGDUMP, PostgreSQL, S57, SQLite, Selafin, TIGER, VDV,
63 VICAR, WAsP, XLSX, netCDF
64 Default: ESRI_Shapefile
65
66 options=string[,string,...]
67 Creation options
68 Examples:
69 Â Â Â Â Â Â Â Â ’SHPT=POINTZ’: create 3D point Shapefile data
70 Â Â Â Â Â Â Â Â ’GEOM_TYPE=geography’: use geography PostGIS data
71 Â Â Â Â Â Â Â Â ’SCHEMA=grass’: create new PostGIS tables in
72 ’grass’ schema
73
74 loadsettings=name
75 Name of input file to read settings from
76
77 savesettings=name
78 Name for output file where to save current settings
79
81 v.external.out instructs GRASS to write vector maps in external data
82 format (e.g. ESRI Shapefile, Mapinfo, and others) using OGR library.
83 PostGIS data can be also written by built-in GRASS-PostGIS data
84 provider.
85
87 Number of available output formats (v.external.out -f) depends on OGR
88 installation. ’PostgreSQL’ format is presented also when GRASS comes
89 with PostgreSQL support (check for ’--with-postgres’ in g.version -b
90 output).
91
92 To store geometry and attribute data in PostGIS database (’PostgreSQL’
93 format) GRASS uses built-in GRASS-PostGIS data provider. PostGIS data
94 can be written also by OGR library when GRASS_VECTOR_OGR environmental
95 variable is defined or GRASS is not compiled with PostgreSQL support.
96
97 Creation options refer to the output format specified by format option.
98 See the list of valid creation options at OGR formats specification
99 page, example for ESRI Shapefile or PostgreSQL/PostGIS format (section
100 "Layer Creation Options"). Options are comma-separated pairs
101 (key=value), the options are case-insensitive, eg. op‐
102 tions="SCHEMA=myschema,FID=cat".
103
104 PostgreSQL/PostGIS Creation Options
105 Note that built-in GRASS-PostGIS data provider (format=PostgreSQL) sup‐
106 ports different creation options compared to PostgreSQL/PostGIS driver
107 from OGR library:
108
109 • SCHEMA=<name> - name of schema where to create feature tables.
110 If schema doesn’t exists, it’s automatically created when writ‐
111 ing PostGIS data.
112
113 • FID=<column> - name of column which will be used as primary key
114 (feature id), default: fid
115
116 • GEOMETRY_NAME=<column> name of column which will be used for
117 storing geometry data in feature table, default: geom
118
119 • SPATIAL_INDEX=YES|NO - enable/disable spatial index on geometry
120 column, default: YES
121
122 • PRIMARY_KEY=YES|NO - enable/disable primary key on FID column,
123 default: YES
124
125 • SRID=<value> - spatial reference identifier, default: not de‐
126 fined
127
128 • TOPOLOGY=YES|NO - enable/disable native PostGIS topology, de‐
129 fault: NO
130 Options relevant only to topological output (TOPOLOGY=YES):
131
132 • TOPOSCHEMA_NAME=<schema name> - name of PostGIS Topology schema
133 (relevant only for TOPOLOGY=YES), default: topo_<input>
134
135 • TOPOGEOM_NAME=<column> - name of column which will be used for
136 storing topogeometry data in feature table, default: topo
137
138 • TOPO_TOLERANCE=<value> - tolerance for PostGIS Topology schema,
139 see CreateTopology function for defails, default: 0
140
141 • TOPO_GEO_ONLY=YES|NO - store in PostGIS Topology schema only
142 data relevant to Topo-Geo data model, default: NO
143
144 • SIMPLE_FEATURE=YES|NO - build simple features geometry in GEOM‐
145 ETRY_NAME column from topogeometry data, default: NO
146 Note that topological output requires PostGIS version 2 or later.
147
149 ESRI Shapefile
150 v.external.out can be used along with v.external to process external
151 geodata in GRASS while writing out the results directly eg. in ESRI
152 Shapefile format:
153 # register Shapefile in GRASS mapset:
154 v.external input=/path/to/shapefiles layer=cities
155 # define output directory for GRASS calculation results:
156 v.external.out output=$HOME/gisoutput
157 # do something (here: spatial query), write output directly as Shapefile
158 v.select ainput=cities atype=point binput=forests btype=area operator=within output=fcities
159 Current settings can be printed using -p or -g flag.
160 v.external.out -p
161 output: /path/to/home/gisoutput
162 format: ESRI Shapefile
163
164 PostGIS (simple features)
165 PostGIS data can be accessed directly using GRASS-PostGIS data provider
166 (GRASS must be compiled with PostgreSQL support).
167 # register PostGIS table in GRASS mapset:
168 v.external output=PG:dbname=gisdb layer=cities
169 # define output PostGIS database for GRASS calculation results stored as simple features:
170 v.external.out output=PG:dbname=gisdb format=PostgreSQL
171 # do some processing...
172 Note: If the environment variable GRASS_VECTOR_OGR is defined, or GRASS
173 is compiled without PostgreSQL support then GRASS will use PostgreSQL
174 driver from OGR library for reading and writing PostGIS data.
175
176 PostGIS Topology
177 # define output PostGIS database for GRASS calculation results stored as topological elements:
178 v.external.out output=PG:dbname=gisdb format=PostgreSQL options=topology=YES
179 # do some processing...
180 Note: PostGIS topological access is supported only in built-in
181 GRASS-PostGIS data provider.
182
183 GRASS native format
184 To restore original settings, ie. use the GRASS native format, type:
185 v.external.out -r
186
187 Restore settings
188 Current settings can be stored to file by specifying output option.
189 # define output PostGIS database for GRASS calculation with
190 # results stored as topological elements:
191 v.external.out output=PG:dbname=gisdb format=PostgreSQL \
192 options=topology=YES savesettings=gisdb_topo.txt
193 # ... and do some processing in PostGIS Topology
194 Back to native format:
195 v.external.out -r
196 # do some processing in native format
197 Restore previous settings from "gisdb_topo.txt" file by specifying
198 loadsettings option.
199 v.external.out loadsettings=gisdb_topo.txt
200 # ... and do some processing in PostGIS Topology
201
203 • GRASS-OGR data provider
204
205 • OGR vector library C API documentation
206
207 • GRASS-PostGIS data provider
208
209 • libpq - C Library
210
212 v.external, v.in.ogr, v.out.ogr, v.out.postgis
213
214 See also GRASS user wiki page for more examples.
215
217 Martin Landa, Czech Technical University in Prague, Czech Republic (de‐
218 velopment supported by Fondazione Edmund Mach and Comune di Trento,
219 Italy)
220
222 Available at: v.external.out source code (history)
223
224 Accessed: Mon Jun 20 16:47:20 2022
225
226 Main index | Vector index | Topics index | Keywords index | Graphical
227 index | Full index
228
229 © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
230
231
232
233GRASS 8.2.0 v.external.out(1)