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

NAME

6       v.select  - Selects features from vector map (A) by features from other
7       vector map (B).
8

KEYWORDS

10       vector, geometry, spatial query
11

SYNOPSIS

13       v.select
14       v.select --help
15       v.select          [-tcr]          ainput=name           [alayer=string]
16       [atype=string[,string,...]]         binput=name         [blayer=string]
17       [btype=string[,string,...]]     output=name    operator=string     [re‐
18       late=string]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]
19
20   Flags:
21       -t
22           Do not create attribute table
23
24       -c
25           Do not skip features without category
26
27       -r
28           Reverse selection
29
30       --overwrite
31           Allow output files to overwrite existing files
32
33       --help
34           Print usage summary
35
36       --verbose
37           Verbose module output
38
39       --quiet
40           Quiet module output
41
42       --ui
43           Force launching GUI dialog
44
45   Parameters:
46       ainput=name [required]
47           Name of input vector map
48           Input vector map from which to select features (A)
49
50       alayer=string
51           Layer number (vector map A)
52           Vector  features can have category values in different layers. This
53           number determines which layer to use. When used with direct OGR ac‐
54           cess this is the layer name.
55           Default: 1
56
57       atype=string[,string,...]
58           Feature type (vector map A)
59           Input feature type
60           Options: point, line, boundary, centroid, area
61           Default: point,line,area
62
63       binput=name [required]
64           Name of input vector map
65           Query vector map (B)
66
67       blayer=string
68           Layer number (vector map B)
69           Vector  features can have category values in different layers. This
70           number determines which layer to use. When used with direct OGR ac‐
71           cess this is the layer name.
72           Default: 1
73
74       btype=string[,string,...]
75           Feature type (vector map B)
76           Input feature type
77           Options: point, line, boundary, centroid, area
78           Default: point,line,area
79
80       output=name [required]
81           Name for output vector map
82
83       operator=string [required]
84           Operator defines required relation between features
85           A  feature  is written to output if the result of operation ’ainput
86           operator binput’ is true. An input  feature  is  considered  to  be
87           true, if category of given layer is defined.
88           Options:  overlap,  equals, disjoint, intersects, touches, crosses,
89           within, contains, overlaps, relate
90           Default: overlap
91           overlap: features partially or completely overlap
92           equals: features are spatially equals (using GEOS)
93           disjoint: features do not spatially intersect (using GEOS)
94           intersects: features spatially intersect (using GEOS)
95           touches: features spatially touches (using GEOS)
96           crosses: features spatially crosses (using GEOS)
97           within: feature A is completely inside feature B (using GEOS)
98           contains: feature B is completely inside feature A (using GEOS)
99           overlaps: features spatially overlap (using GEOS)
100           relate: feature A is spatially related to feature  B  (using  GEOS,
101           requires ’relate’ option)
102
103       relate=string
104           Intersection Matrix Pattern used for ’relate’ operator
105

DESCRIPTION

107       v.select  allows  the user to select features from a vector map by fea‐
108       tures from another one.
109
110       Supported operators (without GEOS; using GRASS’ own algorithm):
111
112overlap - features partially or completely overlap (GEOS equiv‐
113               alent: intersects)
114       Supported  operators  (internally  using  GEOS  - Geometry Engine, Open
115       Source):
116
117equals - features are spatially equals
118
119disjoint - features do not spatially intersect
120
121intersects - features spatially intersect (equivalent to native
122               ’overlap’)
123
124touches - features spatially touches
125
126crosses - features spatially crosses
127
128within - feature A is completely inside feature B
129
130contains - feature B is completely inside feature A
131
132overlaps - features spatially overlap
133
134relate - feature A is spatially related to feature B
135

NOTES

137       Only features with category numbers will be considered. If required the
138       v.category module can be used to add them. Typically boundaries do  not
139       need  to be given a category number, as an area’s attributes are inher‐
140       ited from the centroid. Typically points, lines, and centroids will al‐
141       ways  want  to  have a cat number. E.g. take a road which separates two
142       farms. It is ambiguous as to which farm an attribute that  is  attached
143       to the road belongs to. The boundary only needs a cat number if it will
144       hold its own attributes, such as road name or pavement form. A centroid
145       in  each paddock holds the information with respect to ownership, area,
146       etc.
147

EXAMPLES

149       Preparation of example data (North Carolina sample dataset):
150       # Create an grid for overlaying to ZIP code vector map
151       v.mkgrid map=boxgrid grid=10,10 position=coor \
152                coordinates=583600,201500 box=5000,5000
153       # set region to ZIP codes and boxgrid vector maps
154       g.region vector=zipcodes_wake,boxgrid -p res=100 -a
155       # enlarge region a bit for "white border" around map in monitor
156       g.region n=n+1000 s=s-1000 w=w-1000 e=e+1000 -p
157       d.mon wx0
158
159   OVERLAP: features partially or completely overlap (using GRASS)
160       Select grid boxes (North Carolina sample dataset):
161       d.vect map=zipcodes_wake fill_color=0:128:0
162       d.vect map=boxgrid fill_color=85:130:176
163       v.select ainput=boxgrid binput=zipcodes_wake output=v_select_OVERLAP operator=overlap
164       d.vect map=v_select_OVERLAP
165       d.vect map=zipcodes_wake type=boundary color=255:255:50
166       v.select with OVERLAP operator: selected grid  boxes  shown  in  yellow
167       (using GRASS method)
168
169   OVERLAPS features spatially overlap (using GEOS)
170       Select grid boxes (North Carolina sample dataset):
171       d.vect map=zipcodes_wake fill_color=0:128:0
172       d.vect map=boxgrid fill_color=85:130:176
173       v.select ainput=boxgrid binput=zipcodes_wake output=v_select_OVERLAPS operator=overlaps
174       d.vect map=v_select_OVERLAPS
175       d.vect map=zipcodes_wake type=boundary color=255:255:50
176       v.select  with  OVERLAPS  operator: selected grid boxes shown in yellow
177       (using GEOS method)
178
179   DISJOINT: features do not spatially intersect (using GEOS)
180       Select grid boxes (North Carolina sample dataset):
181       d.vect map=zipcodes_wake fill_color=0:128:0
182       d.vect map=boxgrid fill_color=85:130:176
183       v.select ainput=boxgrid binput=zipcodes_wake output=v_select_DISJOINT operator=disjoint
184       d.vect map=v_select_DISJOINT
185       d.vect map=zipcodes_wake type=boundary color=255:255:50
186       v.select with DISJOINT operator: selected grid boxes shown in yellow
187
188   EQUALS: features are spatially equals (using GEOS)
189       Select zipcode polygon (North Carolina sample dataset):
190       d.vect map=zipcodes_wake fill_color=0:128:0
191       v.extract input=zipcodes_wake where=ZIPCODE_ID=35 output=zipcodeID35
192       v.select ainput=zipcodes_wake binput=zipcodeID35 output=v_select_EQUALS operator=equals
193       d.vect map=v_select_EQUALS
194       d.vect map=zipcodes_wake type=boundary color=255:255:50
195       v.select with EQUALS operator: selected grid boxes shown in yellow
196
197   INTERSECTS: features spatially intersect (using GEOS)
198       Select zipcode polygons (North Carolina sample dataset):
199       d.vect map=zipcodes_wake fill_color=0:128:0
200       d.vect map=boxgrid fill_color=85:130:176
201       v.select ainput=zipcodes_wake binput=boxgrid output=v_select_INTERSECTS operator=intersects
202       d.vect map=v_select_INTERSECTS
203       d.vect map=boxgrid type=boundary color=255:255:50
204       v.select with INTERSECTS operator: selected grid boxes shown in yellow
205
206   TOUCHES: features spatially touches (using GEOS)
207       Select polygons (North Carolina sample dataset):
208       d.vect map=zipcodes_wake fill_color=0:128:0
209       d.vect map=zipcodeID35 fill_color=85:130:176
210       v.select ainput=zipcodes_wake binput=zipcodeID35 output=v_select_TOUCHES operator=touches
211       d.vect map=v_select_TOUCHES
212       d.vect map=zipcodes_wake type=boundary color=255:255:50
213       v.select with TOUCHES  operator:  selected  polygons  shown  in  yellow
214       (blue: input polygon)
215
216   CROSSES: features spatially crosses (using GEOS)
217       Select zipcode polygons by lines (North Carolina sample dataset):
218       d.vect map=zipcodes_wake fill_color=0:128:0
219       d.vect map=busroute1 color=200:27:27 width=3
220       v.select ainput=zipcodes_wake binput=busroute1 output=v_select_CROSSES operator=crosses
221       d.vect map=v_select_CROSSES
222       d.vect map=zipcodes_wake type=boundary color=255:255:50
223       d.vect map=busroute1 color=200:27:27 width=3
224       v.select with CROSSES operator: selected polygons shown in yellow (red:
225       input lines)
226
227   WITHIN feature A is completely inside feature B (using GEOS)
228       Select zipcode polygons (North Carolina sample dataset):
229       d.vect map=zipcodes_wake fill_color=0:128:0
230       d.vect map=boundary_county fill_color=85:130:176
231       v.select ainput=zipcodes_wake binput=boundary_county output=v_select_WITHIN operator=within
232       d.vect map=v_select_WITHIN
233       v.select with WITHIN operator: selected polygons shown in yellow (blue:
234       input polygons)
235
236   CONTAINS feature B is completely inside feature A (using GEOS)
237       Select zipcode polygon (North Carolina sample dataset):
238
239   CONTAINS with polygons
240       d.vect map=zipcodes_wake fill_color=0:128:0
241       d.vect map=zipcodeID35 fill_color=85:130:176
242       v.select ainput=zipcodes_wake binput=zipcodeID35 \
243                output=v_select_CONTAINS_pol operator=contains
244       d.vect map=v_select_CONTAINS
245       v.select  with  CONTAINS  operator:  selected  polygon  shown in yellow
246       (blue: input polygon, not visible)
247
248   CONTAINS with points
249       d.vect map=zipcodes_wake fill_color=0:128:0
250       d.vect map=hospitals fill_color=195:31:31 icon=basic/cross3 size=10
251       v.select ainput=zipcodes_wake binput=hospitals \
252                output=v_select_CONTAINS_pnts operator=contains
253       d.vect map=v_select_CONTAINS_pnts
254       d.vect map=hospitals fill_color=195:31:31 icon=basic/cross3 size=10
255       v.select with CONTAINS operator:  selected  polygons  shown  in  yellow
256       (red: input points)
257
258   RELATE feature A is spatially related to feature B (using GEOS)
259       This  operator additionally requires the relate parameter (in other GIS
260       called ’ST_Relate’).  This operator allows calculating  the  Dimension‐
261       ally  Extended  nine-Intersection Model (DE-9IM).  In the following one
262       example: Select polygon with ’TOUCHES’ operator (North Carolina  sample
263       dataset):
264       d.vect map=zipcodes_wake fill_color=0:128:0
265       d.vect map=zipcodeID35 fill_color=85:130:176
266       v.select ainput=zipcodeID35 binput=zipcodes_wake \
267                output=v_select_TOUCHES_relate operator=relate relate=’T********’
268       d.vect map=v_select_TOUCHES
269       The result of relate=’T********’ is the same as seen above in the exam‐
270       ple ’TOUCHES’.  See the DE-9IM page for  related  operators  and  their
271       definition.
272
273   Extraction of points falling into a polygon
274       Extract  fire  stations  (points)  falling  into urban area (polygon) -
275       North Carolina data set (point in polygon test):
276       v.select ainput=firestations binput=urbanarea output=urban_firestations \
277                operator=overlap
278
279   Extraction of lines overlapping with a polygon
280       Extract railroad lines from zip code map  overlapping  with  the  urban
281       area (line in polygon test):
282       v.select ainput=railroads binput=urbanarea \
283                output=railroads_in_urbanarea operator=overlap
284
285   Extraction of areas overlapping with a line
286       Extract  those  areas  from  zip  code map which overlap with railroads
287       (polygon on line test):
288       # first add a tiny buffer around railroad lines:
289       v.buffer input=railroads output=railroads_buf20m \
290         distance=20
291       v.select ainput=zipcodes_wake binput=railroads_buf20m \
292         output=zipcodes_wake_railroads operator=overlap
293

SEE ALSO

295        v.category, v.clip, v.overlay, v.extract
296
297       GRASS SQL interface
298       GEOS - Geometry Engine, Open Source
299

AUTHORS

301       Radim Blazek
302       GEOS support by Martin Landa, Czech  Technical  University  in  Prague,
303       Czech Republic
304       ZIP code examples by Carol X. Garzon-Lopez, Trento, Italy
305

SOURCE CODE

307       Available at: v.select source code (history)
308
309       Accessed: Mon Jun 20 16:47:14 2022
310
311       Main  index  | Vector index | Topics index | Keywords index | Graphical
312       index | Full index
313
314       © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
315
316
317
318GRASS 8.2.0                                                        v.select(1)
Impressum