1v.db.select(1) GRASS GIS User's Manual v.db.select(1)
2
3
4
6 v.db.select - Prints vector map attributes.
7
9 vector, attribute table, database, SQL
10
12 v.db.select
13 v.db.select --help
14 v.db.select [-rcvf] map=name [layer=string] [col‐
15 umns=name[,name,...]] [where=sql_query] [group=string] [separa‐
16 tor=character] [vertical_separator=character] [null_value=string]
17 [file=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
18
19 Flags:
20 -r
21 Print minimal region extent of selected vector features instead of
22 attributes
23
24 -c
25 Do not include column names in output
26
27 -v
28 Vertical output (instead of horizontal)
29
30 -f
31 Exclude attributes not linked to features
32
33 --overwrite
34 Allow output files to overwrite existing files
35
36 --help
37 Print usage summary
38
39 --verbose
40 Verbose module output
41
42 --quiet
43 Quiet module output
44
45 --ui
46 Force launching GUI dialog
47
48 Parameters:
49 map=name [required]
50 Name of vector map
51 Or data source for direct OGR access
52
53 layer=string
54 Layer number or name
55 Vector features can have category values in different layers. This
56 number determines which layer to use. When used with direct OGR
57 access this is the layer name.
58 Default: 1
59
60 columns=name[,name,...]
61 Name of attribute column(s)
62
63 where=sql_query
64 WHERE conditions of SQL statement without ’where’ keyword
65 Example: income < 1000 and population >= 10000
66
67 group=string
68 GROUP BY conditions of SQL statement without ’group by’ keyword
69
70 separator=character
71 Field separator
72 Special characters: pipe, comma, space, tab, newline
73 Default: pipe
74
75 vertical_separator=character
76 Output vertical record separator
77 Special characters: pipe, comma, space, tab, newline
78
79 null_value=string
80 String representing NULL value
81
82 file=name
83 Name for output file (if omitted or "-" output to stdout)
84
86 v.db.select prints attributes of a vector map from one or several user
87 selected attribute table columns.
88
90 All examples are based on the North Carolina sample dataset.
91
92 Select and show entire table
93 v.db.select map=roadsmajor
94 cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
95 1|1|NC-50|no|0|1|4825.369405
96 2|2|NC-50|no|0|2|14392.589058
97 3|3|NC-98|no|0|3|3212.981242
98 4|4|NC-50|no|0|4|13391.907552
99 ...
100
101 Select and show single column from table
102 Note: multiple columns can be specified as comma separated list.
103 v.db.select map=roadsmajor column=ROAD_NAME
104 NC-50
105 NC-50
106 NC-98
107 NC-50
108 NC-98
109 ...
110
111 Print region extent of selected vector features
112 v.db.select -r map=roadsmajor where="ROAD_NAME = ’NC-98’"
113 n=248425.389891
114 s=245640.640081
115 w=635906.517653
116 e=661979.801880
117
118 Select empty vector features (no data entries)
119 v.db.select geonames_wake where="ALTERNATEN IS NULL"
120 cat|GEONAMEID|NAME|ASCIINAME|ALTERNATEN|FEATURECLA|FEATURECOD|...
121 8|4498303|West Raleigh|West Raleigh||P|PPL|US||NC|338759|123|...
122 14|4459467|Cary|Cary||P|PPL|US||NC|103945|146|152|America/Iqaluit|...
123 31|4452808|Apex|Apex||P|PPL|US||NC|30873|167|134|America/Iqaluit|...
124 ...
125
126 Select not empty vector features (no data entries)
127 v.db.select geonames_wake where="ALTERNATEN IS NOT NULL"
128 cat|GEONAMEID|NAME|ASCIINAME|ALTERNATEN|FEATURECLA|FEATURECOD|...
129 9|4487042|Raleigh|Raleigh|Raleigh,...
130 31299|4487056|Raleigh-Durham Airport|Raleigh-Durham Airport|...
131 ...
132
133 Select features with distinct road names
134 v.db.select map=roadsmajor columns=ROAD_NAME group=ROAD_NAME
135 ROAD_NAME
136 I-40
137 I-440
138 I-540
139 NC-231
140 NC-39
141 NC-42
142 ...
143 It is also possible to combine with where option
144 v.db.select map=roadsmajor columns=ROAD_NAME,MULTILANE group=ROAD_NAME where=’ROAD_NAME is not null’
145 ROAD_NAME|MULTILANE
146 I-40|yes
147 I-440|yes
148 I-540|yes
149 NC-231|no
150 NC-39|no
151 NC-42|no
152 NC-50|no
153 NC-54|no
154 NC-55|no
155 NC-96|no
156 NC-97|no
157 NC-98|no
158 US-1|
159 US-401|no
160 US-64|yes
161 US-70|yes
162 It can also use more columns in group option
163 v.db.select map=roadsmajor columns=ROAD_NAME,MULTILANE group=ROAD_NAME,MULTILANE where=’ROAD_NAME is not null’
164 ROAD_NAME|MULTILANE
165 I-40|yes
166 I-440|yes
167 I-540|yes
168 NC-231|no
169 NC-39|no
170 NC-42|no
171 NC-50|no
172 NC-54|no
173 NC-55|no
174 NC-96|no
175 NC-97|no
176 NC-98|no
177 US-1|
178 US-1|yes
179 US-401|no
180 US-401|yes
181 US-64|yes
182 US-70|yes
183
185 db.select
186
188 Radim Blazek, ITC-Irst, Trento, Italy
189 Minimal region extent added by Martin Landa, FBK-irst (formerly
190 ITC-irst), Trento, Italy (2008/08)
191 Group option added by Luca Delucchi, Fondazione Edmund Mach, Trento,
192 Italy (2015/12)
193
195 Available at: v.db.select source code (history)
196
197 Main index | Vector index | Topics index | Keywords index | Graphical
198 index | Full index
199
200 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
201
202
203
204GRASS 7.8.5 v.db.select(1)