[GRASS-user] v.select incredibly slow

Moritz Lennert mlennert at club.worldonline.be
Sun Mar 28 04:49:37 PDT 2021


Hi Uwe,

Am 27. März 2021 14:58:01 MEZ schrieb Uwe Fischer <gisfisch at t-online.de>:
>Hello list,
>
>I have trouble selecting line features using their location compared to a
>polygon layer using v.select. The line features I want to select from are
>parcel borders, and the polygon layer is made up of tubular-shaped buffers
>around municipal borders. I need to find the parcel borders which are inside
>this buffer.
>
>The command line in a Python script I use is:
>
>grass.run_command('v.select', ainput='temp5', atype='line', binput='buff',
>blayer=1, btype='area', output='grenz', operator='within', overwrite=True)
>
>The process starts, but it runs incredibly slow (> 15 min) and it brings not
>the desired result (but trash data). When I start it in the GRASS ui, it
>also works very very slow.
>
>I have only about 2000 parcel borders, so it cannot be a problem of too much
>features. Furthermore, the exact same selection task is processed in QGIS 3
>in a second with perfect results.
>
>I used v.build on both maps before v.select, but it does not help.
>
>I would like to perform it in GRASS because it is part of a bigger data
>preparation script which makes my work a lot easier. So I need to integrate
>it here rather than selecting in QGIS manually.


First of all: which version of GRASS GIS are you using ?

I filed a bug about this same issue a few years ago [1] and Markus Metz reorganized the code at the time to speed things up. I don't remember which version was the first to include the fixes (7.6 ?). However, even though it was slow, results were ok which doesn't seem to be the case for you, so that is a bit worrying.

Can you reproduce the same issue with the example given in that bug report ? If not can you provide a reproducible example, including relevant data ? Ideally as a GitHub issue ?

As a workaround you could try either the alternative provided in the bug report, or you  could try to reduce the number of line candidates first using v.select operator=overlap and using operator=within only on those selected in the first call.

Moritz

[1] https://trac.osgeo.org/grass/ticket/3361


More information about the grass-user mailing list