[GRASS-dev] Spatial vector selection by another vector without creating a new vector

Moritz Lennert mlennert at club.worldonline.be
Wed May 18 07:26:39 PDT 2016

On 17/05/16 23:21, Helmut Kudrnovsky wrote:
> Hi,
> given following workflow:
> - Polygon vector A, line vector B
> - Spatially select those polygone in A which are e.g. touched by some lines
> in B
> - open attribute table, view entries selected by step before
> - update some columns of the selected entries
> as this workflow is available in mostly all modern desktop GIS, I couldn't
> find a smart way in GRASS GIS to do this.
> any hints are welcome.


- Create a column line_cat in vector A
- Use v.distance with dmax=0 to get upload cat value of line that 
crosses polygon
- v.db.update on the other column using where="line_cat is not null"

This could be wrapped up in a script...

> If it is not implemented, should I open an enhancement ticket because it is
> a common needed workflow?

This has been briefly mentioned as one advantage of 'virtual maps', 
discussed as an alternative to cat/where parameters in vector modules [1].

I agree that "on-the-fly" selection of features by others would be quite 
useful. I use this quite a lot in QGIS for example (e.g. through the 
spatial queries plugin). Although, I haven't seen an option to update a 
column just for selected features. I use it, for example, to calculate 
statistics on vector attributes only for those that are selected, etc.


[1] https://trac.osgeo.org/grass/ticket/1798#comment:12

More information about the grass-dev mailing list