Feature request #19733

Updated by Jürgen Fischer about 6 years ago

*new description*
#19733-5 https://issues.qgis.org/issues/19733#note-5

*old description*
Processing > GRASS 7 > v.rast.stats is not functional (reported also in several forums [1]). The reason is apparently a parse error since column names have multiple "_". When reducing the statistical measures to those without underscore (e.g."sum") it works. When having "percentile" is doesn't since the percentile value is transferred via underscore, e.g. "percentile=95" becomes "percentile_95" which is not parsed properly in QGIS processing.

By default all measure are active, i.e.
number,minimum,maximum,range,average,stddev,variance,coeff_var,sum,first_quartile,median,third_quartile,percentile

Issue is in both QGIS 2.18.x as well as 3.2.x.

Log:

Algorithmus v.rast.stats - Calculates univariate statistics from a raster map based on vector polygons and uploads statistics to new attribute columns. startet...
g.proj -c proj4="+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812 +units=m +no_defs"
v.in.ogr min_area=0.0001 snap=-1 input="/home/user/geodata_dav/mundialis_daten/projekte/who_geodata/data/Districts" layer=Districts output=tmp15356101025715 --overwrite -o
r.external input="/home/user/ES5_TemperatureCoolingModul/actualT_dailymean.tif" band=1 output=tmp15356101025716 --overwrite -o
g.region n=322441.565 s=312777.529 e=180172.152 w=172817.428 res=10.0064272109
v.rast.stats -c map="tmp15356101025715" raster="tmp15356101025716" column_prefix="s" method="third_quartile,percentile" percentile="2" --overwrite
v.out.ogr --overwrite -s -e input=tmp15356101025715 output="/tmp/processing5113522d9c174e7bb445f24ef38c5f5a/135e78c4ae1d430da568b502506b4ab0" format=ESRI_Shapefile output_layer=output
[...]
Preprocessing input data...
Processing input data (7 categories)...
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100
Updating the database ...
ERROR 6: Failed to add field named 's_third_quartile'
ERROR 6: Failed to add field named 's_percentile_2'
Exporting 13 areas (may take some time)...
7..15..23..30..38..46..53..61..69..76..84..92..100

Assumed solution: fix the parsing of the column names (allow for multiple underscores).

[1] Reported without solution here:
* https://stackoverflow.com/questions/51244882/v-rast-stats-in-qgis-3-2
* https://github.com/jannes-m/RQGIS/issues/99
* ...

Back