I'm trying to find the sum of all raster values unweighted, that touch my polygon layer.

In the picture I've below that would give me a sum of 7.4, instead it calculates it as 6.55 because the top left raser value is not added to the selected polygons sum. I've read somewhere that Zonal Statistics uses the center of either raster or vector layer to determine if it is added. I was wondering if there is a way around this.

This is a very large dataset 1.8 gigabyte in a 1.6 x 1.6 m grid covering a whole municipality. Converting everything to vectors would i believe is nearly impossible and using a buffer would probably get false results. The polygon layer represents bluespots with water, and the purpose is to get the sum of the rasters onto the polygon, without weighing the sum. The polygons differ a lot in size, from few cells to hundreds of cells.

enter image description here

I have access to Spatial Analyst, 3D Analyst, and ArcGIS 10.7 Advanced Desktop license.

Any suggestions for an alternativ approach, or way around how Zonal Statistics work?

  • 1
    How big is your raster and how many polygons are you talking about? I assume you want to attach the sum of the cells to the polygon? whats the cell size and are your polygons typically just a few cells big? – Hornbydd Nov 24 '20 at 10:57
  • 1
    My raster is about 1.8 gigabyte and covers a whole muncipality in a 1.6 x 1.6 m grid in tiff format. The polygon layer consists of bluespots (water related) and there are about 8000 rows of data. The size of the bluespots is anywhere between a few cells as shown and hundreds of cells. Yes I would like it as a values in the attribute tabel. The picture above should give a value of 7.4 in the attribute tabel. – FoolzRailer Nov 24 '20 at 11:43
  • Convert polygons to raster using field populates by 1. Expand by one cell.. expanded to points, to raster using pointid, to raster, to polygon. This will give you a limited number of 1 cell polygons. You can intersect them with original , after extracting r.values and summarise per original polygon. – FelixIP Nov 24 '20 at 18:40

My approach using ArcMap is to overcome the resampling issue caused by the zonal stats tool is to work in the vector environment. Your data is not enormous, I'm currently working with datasets with 21 billions cells and 60GB in size...X8! You just need to get smarter with setting the processing extent.

Whilst this may not be the fastest approach it would certainly process it:

You could work in modelbuilder but python scripting is probably better for fine tweaking.

  • Iterate over each polygon
  • buffer by say 3.2m (2 pixels)
  • use this temporary buffer dataset to set the processing extent of the raster to polygon tool to create a mini clip of your raster
  • use this temporary buffer dataset to set the processing extent of the raster to point tool to create a set of points.
  • Use your polygon to select by location your gridded polygons
  • Use the selected gridded polygons to select the points. you should have at this point a set of selected points which are the grid cells that overlap your polygon
  • Summarise your grid values in your selected points
  • Join value back to polygon dataset or store it in a table and join it back later.

You could speed up processing by writing temporary datasets to in_memory. If you go down the python scripting route then you could parallelize this problem with the multiprocessing module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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