Select to view content in your preferred language

ArcGis Pro Zonal statistics as table

9214
18
Jump to solution
07-19-2021 10:32 AM
Labels (2)
Hope-Hauptman
Regular Contributor

I have a soil classification raster that I clipped to a 500m radius circle around central contamination points. I am trying to determine the majority soil type (hydrologic group) in the clipped rasters using the Zonal statistics as table tool but I must be doing something wrong? 

I have done this successfully with another raster but there was only one value in the attribute table to calculate the majority within the clip, here there are a more than one column in the attribute table. 

For example in the picture - visually most of the buffer zones seem to have a majority blue by area (soil type B) but I would like ESRI to calculate the majority area for each circle for me... 

Capture.PNG

Tags (2)
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor


> I did do this for another raster but there was only one value and it was categorical - landuse type. 

If you want to do it that way, the solution is to use the Reclassify tool to convert your soil types into integer codes (1,2,3,4..) (like your land use codes were), do your zonal statistics as table to find majority value, and then map the results (1,2,3,4..)  back to soil codes using an expression or lookup table.

I know this seems unwieldy but is because ArcGIS rasters do not store text, they store integer or float numbers, so to do calculations on categorical data the values must  be integer, not text codes like "A/B".

 

View solution in original post

18 Replies
curtvprice
MVP Esteemed Contributor

Your buffers overlap. To get correct results you need to run the Zonal Statistics (or Tabulate Area would be better so you can see more detail) tool for each circle one at a time; you could do this using modelbuilder or python iteration. There are some development efforts to avoid the overlap problem but since this is a small number I would just do the buffers one  by one.

Moving this to the Spatial Analyst space where lots of smart people may have more suggestions.

Hope-Hauptman
Regular Contributor

This is just a small picture. I have thousands of clips. 

0 Kudos
curtvprice
MVP Esteemed Contributor

I did build a tool to Weed Points (NACT) so you can do them in groups. But, I looked in the help and at ArcGIS Pro version 2.8 (but not ArcMap 10.8, unfortunately), Zonal Statistics As Table handles overlapping polygons. How wonderful!

I re-read your question. If the value is in another field in the raster table besides Value, you can create a new raster of the table value you want using the Lookup tool. 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

A few check-points. Please verify

1. Use the buffer polygon layer as Input Feature Zone Data. For the Zone Field, use a field of unique values like "ObjectID". Ensure no "Buffer" polygon Feature part is selected in the map.

*EDIT: Ensure there are no multipart feature in the Buffer layer. While creating the buffer from the points, the Dissolve Type parameter should be "No Dissolve".

2. For input value Raster, you may use the clipped raster (or even better, the full Raster).

3. For Statistics Type, check with "MAJORITY"



Think Location
0 Kudos
Hope-Hauptman
Regular Contributor

Yes check on all those boxes. I tried it again using the full raster as the input raster but instead of the majority soil hydrologic group as the majority group I get an area number for the majority? See pic.

0 Kudos
curtvprice
MVP Esteemed Contributor

Rasters are stored and manipulated as numbers not text. So to get the value in the table you probably need to do a join (Join Field is probably the easiest way to do this) to copy the hydro group value over to the table from the input raster table (Value being the join field).

Another thing to look out for is that the majority is not necessarily a plurality, that is if a buffer has enough hydro groups, you may want to use the Tabulate Area tool instead so you can see those special cases and deal with them. This will involve a little more database work on the output, but I think it is probably worth it.

0 Kudos
curtvprice
MVP Esteemed Contributor

One more thing this hydro groups are categories and if your interest is to look at well risk, this may be best handled for this analysis by converting the cell values to a vulnerability score (say 1-10) and doing an average instead of picking the majority. Just a thought.

0 Kudos
Hope-Hauptman
Regular Contributor

Thank you - I did successfully use the tabulate area tool but I don't really need the majority area I want the majority soil class. I know I can than add field and calculate the maximum value in each object ID but since i need the category and not the number this isn't really helpful. I hope that makes sense. Like for example in the tabulate screenshot for object ID 1: soil class D has the maximum value in the first row. Bout I don't care about the numerical value - I just need to know that object ID 1 majority is soil class D and so on for the other objects. I did do this for another raster but there was only one value and it was categorical - landuse type. 

I wanted to share the data but it is too large of a file to upload...

0 Kudos
curtvprice
MVP Esteemed Contributor

You can find this out using a calculate field expression to find out which field matches the maximum value row by row.  You would do this with a python code block with the Calculate Field tool, or dump the table and do it in excel and do it there. If the row by row max of the fields is equal to the column you want, that's the answer, so you can use if statements to identify which is the plurality. And maybe another to tag whether it is the majority.

Again, what are you trying to accomplish with this? 

Note there are also some nice SSURGO raster layers in ArcGIS Online that have derived soil properties that can be averaged to get a value not susceptible to the plurality/majority problem. For example see Drainage Class.

 

0 Kudos