[GRASS-dev] v.select features without category skipped

Moritz Lennert mlennert at club.worldonline.be
Thu Nov 17 09:38:02 PST 2016


On 17/11/16 18:06, Moritz Lennert wrote:
> On 17/11/16 14:11, Luca Delucchi wrote:
>> Hi devs,
>>
>> this morning I got a problem with v.select, I don't understand if is a
>> bug or what... I repeated the procedure with north carolina dataset
>>
>> g.region vect=zipcodes -ap
>>
>> v.mkgrid map=zipcodes_grid box=10000,10000
>>
>> v.category zipcodes_grid opt=report
>> Layer/table: 1/zipcodes_grid
>> type       count        min        max
>> point          0          0          0
>> line           0          0          0
>> boundary       0          0          0
>> centroid      42          1         42
>> area           0          0          0
>> face           0          0          0
>> kernel         0          0          0
>> all           42          1         42
>>
>> v.select ain=zipcodes_grid bin=zipcodes operator=touches
>> out=zipcodes_grid_final --o
>> WARNING: Vector map <zipcodes_grid_final> already exists and will be
>>          overwritten
>> Processing features...
>>  100%
>> Processing areas...
>>  100%
>> Writing selected features...
>>  100%
>> Writing attributes...
>> WARNING: Array of values to select from column <cat> is empty
>
> i.e. no features found which is logical, as there are no zipcode areas
> that touch a grid area. 'touches' is normally defined as [1]
>
> "a touches b: they have at least one boundary point in common, but no
> interior points."
>
> Try with intersects, overlaps, etc.
>
> I agree though that the error message is very unclear. After the "Array
> of values ... is empty" it should just stop. After a very rapid look at
> main.c of v.select it seems to me that it doesn't check the result of
> the selection and just goes on trying to write a new file...

Try the attached patch. Not very elegant and not well tested, but seems 
to work for me.

Moritz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v_select_no_features.diff
Type: text/x-patch
Size: 3703 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20161117/433cb6ef/attachment.bin>


More information about the grass-dev mailing list