I have the raster map of monthly precipitation of some years (download from CGIAR http://www.cgiar-csi.org/data/uea-cru-ts-v3-10-01-historic-climate-database) and I need the mean values on a specific area (polygonal shapefile). I tried with zonal statistic but I had not results, the attribute table was empty.

Is it possible that my region is too small for do this?

I'm a bit new in QGIS world.

2 Answers 2


Before using Zonal Statistics make sure that you have same projections for both raster data and vector (shapefile) data. Sometimes different projection produce empty results. In the following example, I used WGS 84 for both raster data (SRTM Global) and a polygon vector data (Test.shp), and I didn't specify any column prefix:

enter image description here

The final output is as follows:

enter image description here

  1. convert raster to vector using (https://online.rapidresizer.com/tracer.php)
  2. Run this python tool:

import arcpy
import xlwt
import os
outfile = "C:\Users\soft\Desktop\Pole\exce\Domain_Description_report.xls"
    if os.path.exists(outfile):
except OSError:
    print 'Unable to delete Report File at '+outfile
book = xlwt.Workbook()
sheet1 = book.add_sheet("Featureclass_coordinates")
cntx1 = 1
sheet1.write(0,0,"Feature Id")
desc = arcpy.Describe(input_fc)
if desc.shapeType.upper()=="POINT":
    for row in arcpy.da.SearchCursor(input_fc, ["OID@", "SHAPE@XY","POLETYPE"]):    
        x,y = row[1]
        if x!=None:
            sheet1.write(cntx1, 0,"Feature "+str(row[0]))
            sheet1.write(cntx1, 1,"{}, {}".format(x, y))
            sheet1.write(cntx1, 2,"{}".format(row[2]))
            cntx1= cntx1 + 1
    print("Loaded Shape file is not a polygon")
  • Side note you have to own esri software to use arcpy Commented Aug 18, 2020 at 17:14

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.