[GRASS-dev] [GRASS-user] RE : RE : Merge polygone with same attribut of a shapefile

Nikos Alexandris wrote:
..

# get stats for cats in layer 2, that is for all different cats!
v.rast.stats -c vector=polygons_tmp raster=RandomRaster column_prefix=rr2
layer=2

#...unfortunately, this last step in uploading stats in to layer 2, fails in
G7 :frowning:

e.g.

v.rast.stats -c -e vector=polygons_tmp layer=2 raster=RandomRaster
colprefix=ee

Processing data (1 categories)...
Updating the database ...
DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such column: ee_n

DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such column: ee_n

ERROR: Error while executing: 'UPDATE polygons_tmp_polygons_2 SET ee_n=196
       , ee_min=10 , ee_max=99 , ee_range=89 , ee_mean=53.8571428571429 ,
       ee_stddev=26.0770052744105 , ee_variance=680.010204081633 ,
       ee_cf_var=48.4188426845818 , ee_sum=10556 , ee_first_quartile=29 ,
       ee_median=54 , ee_third_quartile=76 , ee_percentile_90=90 WHERE
       cat=1'
WARNING: Failed to upload statistics to attribute table of vector map
         <polygons_tmp>.

I think it wrongly look in/for layer=1 ? The "Processing data (1
categories)..." is the suspect because:

# layer=2 contains...
v.db.select polygons_tmp layer=2 col=cat
cat
1
2

# and layer=1 contains

v.db.select polygons_tmp col=cat
cat
1

A bug?

Nikos

# it works in G64! -- note different parameter naming: "colprefix="
v.build polygons_tmp
v.rast.stats -c vector=polygons_tmp layer=2 raster=RandomRaster
colprefix=rr2

On 17/05/13 10:40, Nikos Alexandris wrote:

Nikos Alexandris wrote:
..

# get stats for cats in layer 2, that is for all different cats!
v.rast.stats -c vector=polygons_tmp raster=RandomRaster column_prefix=rr2
layer=2

#...unfortunately, this last step in uploading stats in to layer 2, fails in
G7 :frowning:

e.g.

v.rast.stats -c -e vector=polygons_tmp layer=2 raster=RandomRaster
colprefix=ee

Processing data (1 categories)...
Updating the database ...
DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such column: ee_n

DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such column: ee_n

ERROR: Error while executing: 'UPDATE polygons_tmp_polygons_2 SET ee_n=196
        , ee_min=10 , ee_max=99 , ee_range=89 , ee_mean=53.8571428571429 ,
        ee_stddev=26.0770052744105 , ee_variance=680.010204081633 ,
        ee_cf_var=48.4188426845818 , ee_sum=10556 , ee_first_quartile=29 ,
        ee_median=54 , ee_third_quartile=76 , ee_percentile_90=90 WHERE
        cat=1'
WARNING: Failed to upload statistics to attribute table of vector map
          <polygons_tmp>.

I think it wrongly look in/for layer=1 ? The "Processing data (1
categories)..." is the suspect because:

# layer=2 contains...
v.db.select polygons_tmp layer=2 col=cat
cat
1
2

# and layer=1 contains

v.db.select polygons_tmp col=cat
cat
1

A bug?

v.db.addcolumn seems to lack the layer option here:

https://trac.osgeo.org/grass/browser/grass/trunk/scripts/v.rast.stats/v.rast.stats.py#L194

Try to add it in the script and see if that makes it work.

Moritz

Nikos wrote:
..

>> # get stats for cats in layer 2, that is for all different cats!
>> v.rast.stats -c vector=polygons_tmp raster=RandomRaster column_prefix=rr2
>> layer=2

>> #...unfortunately, this last step in uploading stats in to layer 2, fails
>> in G7 :frowning:

..

Moritz wrote:

v.db.addcolumn seems to lack the layer option here:

https://trac.osgeo.org/grass/browser/grass/trunk/scripts/v.rast.stats/v.rast
.stats.py#L194

Try to add it in the script and see if that makes it work.

Indeed. Milles Mercis, N

ps- Care for a diff? Or already changed?

On 17/05/13 13:08, Nikos Alexandris wrote:

Nikos wrote:
..

# get stats for cats in layer 2, that is for all different cats!
v.rast.stats -c vector=polygons_tmp raster=RandomRaster column_prefix=rr2
layer=2

#...unfortunately, this last step in uploading stats in to layer 2, fails
in G7 :frowning:

..

Moritz wrote:

v.db.addcolumn seems to lack the layer option here:

https://trac.osgeo.org/grass/browser/grass/trunk/scripts/v.rast.stats/v.rast
.stats.py#L194

Try to add it in the script and see if that makes it work.

Indeed. Milles Mercis, N

ps- Care for a diff? Or already changed?

I just committed a fix. Please test to see if it works.

Moritz

..

Moritz:

I just committed a fix. Please test to see if it works.

Works fine, thnx.

N