2

I have 45 tif tiles each of 20-50MB and a single shp file with about 4000 polygons. I want to run zonal histogram in Arcmap 10 to get the number of pixels with each value for each polygon. If I convert a single polygon from the shp to a raster and use it as the zone input, I can get an output that is correct. However, for the whole shp file either as polygons or as rasters, the tool runs and reports that it completes (very fast, a few seconds), but produces no table.

I think it's because there are too many zones, maybe?

My plan had been to run a batch of zonal histograms, one for each of the 45 tifs.

Am I right that I have too many zones?

And what options for workarounds do I have?

5
  • What are you planning to do with 4000*45 datasets? Are you trying to get 45 histograms for each polygon?
    – FelixIP
    Dec 6, 2015 at 19:05
  • Each of the 4000 polygons only overlaps 1-4 (and usually 1) of the tiles. So, I want ~4000 histograms (and really the tables that come with them). I want the distribution of pixel values within each polygon. Dec 6, 2015 at 19:46
  • sounds like a job for a python script. do you use arcpy or regular python + gdal and numpy? and, is processing time an issue? Dec 7, 2015 at 3:35
  • alas, I am not yet a pythoner. some day soon. thanks, though. Dec 7, 2015 at 23:03
  • As per the Tour there should be only one question asked per question.
    – PolyGeo
    Feb 19, 2017 at 5:28

2 Answers 2

5

If your tif files store integer values you might try tabulate area tool (zones-polygon ids), thus transposing the table.

It'll have 4000 rows instead of 4000 columns. If value grids store floating points, convert to integer first, this will still give you good estimate of histogram. All above is worth doing providing you value raster has less than few hundred unique values, i.e. manageable No of fields.

Make cell size into account during conversion from areas to cell count

2
  • Hello could you give more information on what you mean by this? I like the idea of 4000 rows instead of 4000 columns - I keep having qgis crash when computing zonal histogram on large tifs Jan 23 at 16:34
  • I don't know qgis and not sure what is not clear in my suggestion
    – FelixIP
    Jan 23 at 18:34
-1

I have a vector with 23k polygons, and a raster with 8 class. Result: how many classes I have in each polygon?

https://gis.stackexchange.com/a/306266/133755

3
  • unclear if you mean to ask a new question, or if this is an answer to my old question, or what. Dec 18, 2018 at 15:21
  • This code is my answer for you question. This is a alternative solution without Arcgis, just using python script Dec 18, 2018 at 16:00
  • With python, does not exist restriction to number of polygons. Just input shapefile, raster file and whats stats do you need, then, he do. Dec 18, 2018 at 16:04

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.