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

Moritz Lennert mlennert at club.worldonline.be
Fri May 17 01:48:25 PDT 2013


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 :-(
>
> 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


More information about the grass-dev mailing list