v.select(1)

NAME
v.select - Selects features from vector map (A) by features from other vector map (B).

KEYWORDS
vector, geometry, spatial query

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

-c
    Do not skip features without category

-r
    Reverse selection

--overwrite
    Allow output files to overwrite existing files

--help
    Print usage summary

--verbose
    Verbose module output

--quiet
    Quiet module output

--ui
    Force launching GUI dialog

  Parameters:

ainput=name [required]
    Name of input vector map
    Input vector map from which to select features (A)

alayer=string
    Layer number (vector map A)
    Vector features can have category values in different layers. 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,boundary,centroid,area

binput=name [required]
    Name of input vector map
    Query vector map (B)

blayer=string
    Layer number (vector map B)
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is 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,boundary,centroid,area

output=name [required]
    Name for output vector map

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

DESCRIPTION
v.select allows the user to select features from a vector map by features from another one.

Supported operators (without GEOS):

    •   overlap - features partially or completely overlap
Supported operators (with GEOS):

    •   equals - features are spatially equals

    •   disjoint - features do not spatially intersect

    •   intersects - features spatially intersect

    •   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. If required the v.category module can be used to add them. Typically boundaries do not need to be given a category number, as an area’s attributes are inherited from the centroid. Typically points, lines, and centroids will always want to have a cat number. E.g. take a road which separates two farms. It is ambiguous as to which farm an attribute that is attached to the road belongs to. The boundary only needs a cat number if it will hold its own attributes, such as road name or pavement form. A centroid in each paddock holds the information with respect to ownership, area, etc.

EXAMPLES
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

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

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

TODO
Processing areas with GEOS is currently incredibly slow. Significant speed-up is desired.

SEE ALSO
v.category, v.overlay, v.extract

GRASS SQL interface

AUTHORS
Radim Blazek
GEOS support by Martin Landa, Czech Technical University in Prague, Czech Republic

Last changed: $Date: 2014-09-24 17:43:34 +0200 (st, 24 IX 2014) $

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

© 2003-2015 GRASS Development Team, GRASS GIS 7.0.0 Reference Manual