1v.select(1)                   Grass 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
18       [relate=string]     [--overwrite]    [--help]   [--verbose]   [--quiet]
19       [--ui]
20
21   Flags:
22       -t
23           Do not create attribute table
24
25       -c
26           Do not skip features without category
27
28       -r
29           Reverse selection
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       ainput=name [required]
48           Name of input vector map
49           Input vector map from which to select features (A)
50
51       alayer=string
52           Layer number (vector map A)
53           Vector features can have category values in different layers.  This
54           number  determines  which  layer  to use. When used with direct OGR
55           access this is the layer name.
56           Default: 1
57
58       atype=string[,string,...]
59           Feature type (vector map A)
60           Input feature type
61           Options: point, line, boundary, centroid, area
62           Default: point,line,area
63
64       binput=name [required]
65           Name of input vector map
66           Query vector map (B)
67
68       blayer=string
69           Layer number (vector map B)
70           Vector features can have category values in different layers.  This
71           number  determines  which  layer  to use. When used with direct OGR
72           access this is the layer name.
73           Default: 1
74
75       btype=string[,string,...]
76           Feature type (vector map B)
77           Input feature type
78           Options: point, line, boundary, centroid, area
79           Default: point,line,area
80
81       output=name [required]
82           Name for output vector map
83
84       operator=string [required]
85           Operator defines required relation between features
86           A feature is written to output if the result of  operation  ’ainput
87           operator  binput’  is  true.  An  input feature is considered to be
88           true, if category of given layer is defined.
89           Options: overlap, equals, disjoint, intersects,  touches,  crosses,
90           within, contains, overlaps, relate
91           Default: overlap
92           overlap: features partially or completely overlap
93           equals: features are spatially equals (using GEOS)
94           disjoint: features do not spatially intersect (using GEOS)
95           intersects: features spatially intersect (using GEOS)
96           touches: features spatially touches (using GEOS)
97           crosses: features spatially crosses (using GEOS)
98           within: feature A is completely inside feature B (using GEOS)
99           contains: feature B is completely inside feature A (using GEOS)
100           overlaps: features spatially overlap (using GEOS)
101           relate:  feature  A  is spatially related to feature B (using GEOS,
102           requires ’relate’ option)
103
104       relate=string
105           Intersection Matrix Pattern used for ’relate’ operator
106

DESCRIPTION

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

NOTES

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

EXAMPLES

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

SEE ALSO

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

AUTHORS

300       Radim Blazek
301       GEOS  support  by  Martin  Landa, Czech Technical University in Prague,
302       Czech Republic
303       ZIP code examples by Carol X. Garzon-Lopez, Trento, Italy
304
305       Last changed: $Date: 2018-03-19 22:57:45 +0100 (Mon, 19 Mar 2018) $
306

SOURCE CODE

308       Available at: v.select source code (history)
309
310       Main index | Vector index | Topics index | Keywords index  |  Graphical
311       index | Full index
312
313       © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
314
315
316
317GRASS 7.4.4                                                        v.select(1)
Impressum