v.select(1grass)

πŸ’– v.select β€” the GRASS User's Manual glow-up πŸ’–

okay bestie, welcome to v.select (that's v.select(1grass) if we're being formal, which we are not). This is the GRASS tool that lets you pick features out of one vector map based on features in a different vector map. Iconic behavior, honestly.

✨ NAME ✨

v.select β€” selects features from vector map (A) by features from another vector map (B). That's it. That's the whole personality. πŸ¦‹

🌸 KEYWORDS 🌸

vector, geometry, spatial query

(aka: the "where is this thing relative to that other thing" starter pack)

πŸŽ€ SYNOPSIS πŸŽ€

v.select
v.select --help
v.select [-tcr] ainput=name  [alayer=string]
[atype=string[,string,...]]  binput=name  [blayer=string]
[btype=string[,string,...]]  output=name operator=string
[relate=string]   [--overwrite]  [--help]  [--verbose]  [--quiet]
[--ui]

🫢 Flags

  • -t β€” Do not create attribute table. no table for you, bestie πŸ™ˆ
  • -c β€” Do not skip features without category. normally they get skipped, this says nope, keep them πŸ’…
  • -r β€” Reverse selection. flip it and reverse it ✨
  • --overwrite β€” Allow output files to overwrite existing files. (careful, it will genuinely just eat the old one πŸ’€)
  • --help β€” Print usage summary. your lil cheat sheet πŸ“
  • --verbose β€” Verbose module output. it will tell you everything 😭
  • --quiet β€” Quiet module output. shhh, no thoughts, just vibes 🀫
  • --ui β€” Force launching GUI dialog. point-and-click mode, zero cap πŸ–±οΈ

πŸ’œ Parameters

  • ainput=name [required] β€” Name of input vector map. This is the Input vector map from which to select features (A) β€” the main character, the one you're choosing from πŸ‘‘
  • alayer=string β€” Layer number (vector map A). Vector features can have category values in different layers, and this number determines which layer to use. When used with direct OGR access this is the layer name. Default: 1
  • atype=string[,string,...] β€” Feature type (vector map A). Input feature type. Options: point, line, boundary, centroid, area. Default: point,line,area
  • binput=name [required] β€” Name of input vector map. This is the Query vector map (B) β€” the one doing the vibe check πŸ”
  • blayer=string β€” Layer number (vector map B). Same deal as alayer: vector features can have category values in different layers, this number determines which layer to use, and with direct OGR access it's the layer name. Default: 1
  • btype=string[,string,...] β€” Feature type (vector map B). Input feature type. Options: point, line, boundary, centroid, area. Default: point,line,area
  • output=name [required] β€” Name for output vector map. this is where the survivors go πŸŽ€
  • operator=string [required] β€” Operator defines required relation between features. A feature is written to output if the result of operation 'ainput operator binput' is true. An input feature is considered to be true if category of given layer is defined. Options: overlap, equals, disjoint, intersects, touches, crosses, within, contains, overlaps, relate. Default: overlap
    • overlap: features partially or completely overlap
    • equals: features are spatially equals (using GEOS)
    • disjoint: features do not spatially intersect (using GEOS)
    • intersects: features spatially intersect (using GEOS)
    • touches: features spatially touches (using GEOS)
    • crosses: features spatially crosses (using GEOS)
    • within: feature A is completely inside feature B (using GEOS)
    • contains: feature B is completely inside feature A (using GEOS)
    • overlaps: features spatially overlap (using GEOS)
    • relate: feature A is spatially related to feature B (using GEOS, requires 'relate' option)
  • relate=string β€” Intersection Matrix Pattern used for 'relate' operator. (this one is for the spicy custom-relationship girlies ✨)

🌈 DESCRIPTION 🌈

v.select lets you select features from a vector map, using features from another one as the deciding factor. Choose-your-own-adventure but for geometry, fr fr.

Supported operators (without GEOS; using GRASS' own algorithm):

  • overlap β€” features partially or completely overlap (GEOS equivalent: intersects)

Supported operators (internally using GEOS - Geometry Engine, Open Source):

  • equals β€” features are spatially equals
  • disjoint β€” features do not spatially intersect
  • intersects β€” features spatially intersect (equivalent to native 'overlap')
  • touches β€” features spatially touches
  • crosses β€” features spatially crosses
  • within β€” feature A is completely inside feature B
  • contains β€” feature B is completely inside feature A
  • overlaps β€” features spatially overlap
  • relate β€” feature A is spatially related to feature B

🧚 NOTES 🧚

Only features with category numbers will be considered. iykyk β€” no cat number, no entry πŸ™… If you need them, the v.category module can be used to add them.

Typically boundaries do not need to be given a category number, since an area's attributes are inherited from the centroid. Typically points, lines, and centroids will always want to have a cat number. Like… imagine a road that separates two farms. Which farm does an attribute attached to the road even belong to?? Genuinely ambiguous, the drama 😭 The boundary only needs a cat number if it's going to hold its own attributes, such as road name or pavement form. A centroid in each paddock holds the info about ownership, area, etc. πŸ“


✨ EXAMPLES ✨

Real talk, bestie β€” everything below runs on the good ol' North Carolina sample dataset. Buckle up, we're about to meet every single operator. πŸ‘‘


πŸŽ€ Preparation of example data

First we make a grid to overlay on the ZIP code vector map. Building the set, no cap:

# Create an grid for overlaying to ZIP code vector map
v.mkgrid map=boxgrid grid=10,10 position=coor \
         coordinates=583600,201500 box=5000,5000
# set region to ZIP codes and boxgrid vector maps
g.region vector=zipcodes_wake,boxgrid -p res=100 -a
# enlarge region a bit for "white border" around map in monitor
g.region n=n+1000 s=s-1000 w=w-1000 e=e+1000 -p
d.mon wx0

Okay so we set up our monitor and we're ready to vibe. πŸ’…


πŸ’› OVERLAP: features partially or completely overlap (using GRASS)

Select grid boxes (North Carolina sample dataset) β€” she's giving GRASS method:

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=boxgrid fill_color=85:130:176
v.select ainput=boxgrid binput=zipcodes_wake output=v_select_OVERLAP operator=overlap
d.vect map=v_select_OVERLAP
d.vect map=zipcodes_wake type=boundary color=255:255:50

v.select with OVERLAP operator: selected grid boxes shown in yellow (using GRASS method)


πŸ¦‹ OVERLAPS features spatially overlap (using GEOS)

Select grid boxes (North Carolina sample dataset) β€” now the GEOS way, glow up:

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=boxgrid fill_color=85:130:176
v.select ainput=boxgrid binput=zipcodes_wake output=v_select_OVERLAPS operator=overlaps
d.vect map=v_select_OVERLAPS
d.vect map=zipcodes_wake type=boundary color=255:255:50

v.select with OVERLAPS operator: selected grid boxes shown in yellow (using GEOS method)


🌸 DISJOINT: features do not spatially intersect (using GEOS)

Select grid boxes (North Carolina sample dataset) β€” the "we don't know each other" operator 😭:

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=boxgrid fill_color=85:130:176
v.select ainput=boxgrid binput=zipcodes_wake output=v_select_DISJOINT operator=disjoint
d.vect map=v_select_DISJOINT
d.vect map=zipcodes_wake type=boundary color=255:255:50

v.select with DISJOINT operator: selected grid boxes shown in yellow


⭐ EQUALS: features are spatially equals (using GEOS)

Select zipcode polygon (North Carolina sample dataset) β€” fr fr identical twins:

d.vect map=zipcodes_wake fill_color=0:128:0
v.extract input=zipcodes_wake where=ZIPCODE_ID=35 output=zipcodeID35
v.select ainput=zipcodes_wake binput=zipcodeID35 output=v_select_EQUALS operator=equals
d.vect map=v_select_EQUALS
d.vect map=zipcodes_wake type=boundary color=255:255:50

v.select with EQUALS operator: selected grid boxes shown in yellow


🌈 INTERSECTS: features spatially intersect (using GEOS)

Select zipcode polygons (North Carolina sample dataset):

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=boxgrid fill_color=85:130:176
v.select ainput=zipcodes_wake binput=boxgrid output=v_select_INTERSECTS operator=intersects
d.vect map=v_select_INTERSECTS
d.vect map=boxgrid type=boundary color=255:255:50

v.select with INTERSECTS operator: selected grid boxes shown in yellow


πŸŽ€ TOUCHES: features spatially touches (using GEOS)

Select polygons (North Carolina sample dataset) β€” just grazing, respectful personal space:

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=zipcodeID35 fill_color=85:130:176
v.select ainput=zipcodes_wake binput=zipcodeID35 output=v_select_TOUCHES operator=touches
d.vect map=v_select_TOUCHES
d.vect map=zipcodes_wake type=boundary color=255:255:50

v.select with TOUCHES operator: selected polygons shown in yellow (blue: input polygon)


πŸ’œ CROSSES: features spatially crosses (using GEOS)

Select zipcode polygons by lines (North Carolina sample dataset):

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=busroute1 color=200:27:27 width=3
v.select ainput=zipcodes_wake binput=busroute1 output=v_select_CROSSES operator=crosses
d.vect map=v_select_CROSSES
d.vect map=zipcodes_wake type=boundary color=255:255:50
d.vect map=busroute1 color=200:27:27 width=3

v.select with CROSSES operator: selected polygons shown in yellow (red: input lines)


🫢 WITHIN feature A is completely inside feature B (using GEOS)

Select zipcode polygons (North Carolina sample dataset) β€” cozy, tucked in:

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=boundary_county fill_color=85:130:176
v.select ainput=zipcodes_wake binput=boundary_county output=v_select_WITHIN operator=within
d.vect map=v_select_WITHIN

v.select with WITHIN operator: selected polygons shown in yellow (blue: input polygons)


πŸ‘‘ CONTAINS feature B is completely inside feature A (using GEOS)

Select zipcode polygon (North Carolina sample dataset):

CONTAINS with polygons

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=zipcodeID35 fill_color=85:130:176
v.select ainput=zipcodes_wake binput=zipcodeID35 \
         output=v_select_CONTAINS_pol operator=contains
d.vect map=v_select_CONTAINS

v.select with CONTAINS operator: selected polygon shown in yellow (blue: input polygon, not visible)

CONTAINS with points

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=hospitals fill_color=195:31:31 icon=basic/cross3 size=10
v.select ainput=zipcodes_wake binput=hospitals \
         output=v_select_CONTAINS_pnts operator=contains
d.vect map=v_select_CONTAINS_pnts
d.vect map=hospitals fill_color=195:31:31 icon=basic/cross3 size=10

v.select with CONTAINS operator: selected polygons shown in yellow (red: input points)


Okay so this operator additionally needs the relate parameter (in other GIS it's called 'ST_Relate'). This one lets you calculate the Dimensionally Extended nine-Intersection Model (DE-9IM). Here's one example: select polygon with 'TOUCHES' operator (North Carolina sample dataset):

d.vect map=zipcodes_wake fill_color=0:128:0
d.vect map=zipcodeID35 fill_color=85:130:176
v.select ainput=zipcodeID35 binput=zipcodes_wake \
         output=v_select_TOUCHES_relate operator=relate relate='T********'
d.vect map=v_select_TOUCHES

The result of relate='T********' is the same as seen above in the example 'TOUCHES'. See the DE-9IM page for related operators and their definition. ✨


πŸ“ Extraction of points falling into a polygon

Extract fire stations (points) falling into urban area (polygon) β€” North Carolina data set (point in polygon test):

v.select ainput=firestations binput=urbanarea output=urban_firestations \
         operator=overlap

πŸ”₯ Extraction of lines overlapping with a polygon

Extract railroad lines from zip code map overlapping with the urban area (line in polygon test):

v.select ainput=railroads binput=urbanarea \
         output=railroads_in_urbanarea operator=overlap

🌸 Extraction of areas overlapping with a line

Extract those areas from zip code map which overlap with railroads (polygon on line test):

# first add a tiny buffer around railroad lines:
v.buffer input=railroads output=railroads_buf20m \
  distance=20
v.select ainput=zipcodes_wake binput=railroads_buf20m \
  output=zipcodes_wake_railroads operator=overlap

πŸ‘€ SEE ALSO

  • v.category, v.clip, v.overlay, v.extract
  • GRASS SQL interface
  • GEOS - Geometry Engine, Open Source

πŸ’– AUTHORS

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

πŸ“‚ SOURCE CODE

Available at: v.select source code (history)

Latest change: Monday Feb 09 18:47:00 2026 in commit: 8cec756bc3c21c1086ba7c09dfda94b6a0e82f04

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


And that's a wrap bestie πŸ’…βœ¨ this whole vibe lives in the GRASS 8.5.0 reference manual, landing on your screen as v.select(1grass), last touched Monday Feb 09 18:47:00 2026 β€” go select some features, you absolutely ate that. 🫢🌸

πŸ“¦ where this page comes from