[GRASS-dev] v.select: creation primary key / indexing

I just had a case in which I created a new point layer by selecting a subset of points with v.select. I subsequently added a column and used v.what.rast to upload raster values for the points.

The point layer has 2 million points and the v.what.rast took a very long time to update the vector attributes.

As it turns out, this is because the attribute table is without primary key. After adding the primary key the v.what.rast took only a minute or so.
So the question is, would it be an idea to have the v.select create an primary key for the cat column automatically?

p.s. running GRASS 7.1 on Ubuntu 14.04 64bit

On Tue, Sep 23, 2014 at 7:52 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

I just had a case in which I created a new point layer by selecting a subset
of points with v.select. I subsequently added a column and used v.what.rast
to upload raster values for the points.

The point layer has 2 million points and the v.what.rast took a very long
time to update the vector attributes.

As it turns out, this is because the attribute table is without primary key.
After adding the primary key the v.what.rast took only a minute or so.
So the question is, would it be an idea to have the v.select create an
primary key for the cat column automatically?

Good catch.

Can you compile yourself? I have prepared a patch for v.select but
would like to see it tested before cluttering the SVN :slight_smile:

Markus

On Tue, Sep 23, 2014 at 9:45 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Sep 23, 2014 at 7:52 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

I just had a case in which I created a new point layer by selecting a subset
of points with v.select. I subsequently added a column and used v.what.rast
to upload raster values for the points.

The point layer has 2 million points and the v.what.rast took a very long
time to update the vector attributes.

As it turns out, this is because the attribute table is without primary key.
After adding the primary key the v.what.rast took only a minute or so.
So the question is, would it be an idea to have the v.select create an
primary key for the cat column automatically?

Good catch.

I have fixed it in r62093 (trunk) and r62094 (relbr7).

Markus