I am using the GRASS plugin in QGIS. I am trying to calculate the average value of a raster dataset within a set of polygons.

I have created a new mapset and have imported both the vector and raster layers into the GRASS mapset.

I am now trying to calculate the set of statistics using the v.rast.stats tool.

It starts to run and then comes up with the error an error occurred while converting vector to raster and then 'raster map not found'.

v.rast.stats raster=secant_grass@zonalstats
line 190: 632 Segmentation fault v.to.rast in="$VECTORFULL"
out="${VECTOR}_$TMPNAME" layer="$GIS_OPT_LAYER" use=cat type=area
--quiet An error occurred while converting vector to raster Raster map not found  nothing removed Finished with error

3 Answers 3


Use the zonal statistics plugin in QGIS - this gives you the count, sum and mean of a raster within a given polygon.


For QGIS 3.0 and onward, the Zonal Statistics Plugin suggested by @Thomas is included in the Processing Toolbox. So instead of looking for it in the Plugins, just look for the

Zonal Statistics function from the Raster Analysis tools in QGIS.


Or use the version 1.4 of the LecoS plugin for QGIS, if zonal statistics and GRASS fail you. You can find the plugin via the downloader, but you must have the scientific library "Scipy" installed.

See an example use-case on my blog,which deals with exactly your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.