1

I am trying to count the number of times each category of a raster layer appears in a buffer square. I have attached a picture to help explain.

In the picture example I would want the 'red group' to output 2 for that buffer, grey to output 2, green 2, orange 4 and brown either 4 or 5. I need to do this for a few hundred sites so a technique where I can do all buffers at the same time would be good, even if this means only one raster group can be assigned a number at a time e.g. only output for 'red group' in each buffer. I'm not sure if this is possible but I hope so. Would I need to convert the raster layer first - I'm happy to do this is needed?

Not sure if it matters or not but none of my buffers overlap and some raster groups could be in more than one buffer as seen below.

enter image description here

I'm using ArcGIS - ArcMap 10.1. I should have all the licences as it's at University

enter image description here This is the output that I can get

2

You give no indication on the size of the raster or how many buffers so the following approach may be impractical and there is a better way. Anyway here is one method:

  1. Convert your raster to a point dataset, if you use the buffer polygon as a mask you will reduce the data volume.
  2. Assuming you buffers have a unique ID (don't use FID/ObjectID - create one if necessary) use the spatial join tool to join buffer to point layer. The resulting dataset is a new point dataset with the buffer ID's attached.
  3. Run the summary stats tool grouping by buffer ID and counting on grid_code. Not only will you get a table of the number of groups (your colours in your example) but you'll also get a count thus an indication of area.
  • I think that's almost there but not quite. When I run Summary Stats I can get the overall number of groups in all buffers and an indication of area per buffer but not how many of each group per buffer. Am I doing something wrong? – Ben Jun 6 '16 at 12:40
  • You need to set the group by parameter to be grouped by buffer ID. – Hornbydd Jun 6 '16 at 21:05
  • I have tried that but the frequency column and count column are the same. I have to group by both the buffer ID and grid_code; grouping by buffer ID alone gives me 1600 (the number of points) for every buffer. I have added a screen shot above of the output that I get. – Ben Jun 7 '16 at 8:50
  • You run that table through the summary tool again grouping by GRIDNAME and counting on grid_code, so the final result for NT7304 would be 6. – Hornbydd Jun 7 '16 at 10:37
  • That only tells me the number of different types e.g. colours not how many patches of each colour there is. Maybe there isn't a way to do it in ArcMap? – Ben Jun 7 '16 at 14:37

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.