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

SEE ALSO

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

AUTHORS

302       Radim Blazek
303       GEOS  support  by  Martin  Landa, Czech Technical University in Prague,
304       Czech Republic
305       ZIP code examples by Carol X. Garzon-Lopez, Trento, Italy
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.8.2 Reference Manual
314
315
316
317GRASS 7.8.2                                                        v.select(1)
Impressum