Select to view content in your preferred language

ArcGis Pro Zonal statistics as table

9229
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)
18 Replies
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".

 

Hope-Hauptman
Regular Contributor

You are a wonderful person. I cant thank you enough - I've wasted hours on this. I almost want to edit my original question so that others struggling with this can benefit. Have a great day. 

0 Kudos
curtvprice
MVP Esteemed Contributor

But you CAN edit your question! But it is good etiquette to add info in an UPDATE block to preserve the context of the responses to the thread.  Not time wasted, you have learned a lot about Spatial Analyst and rasters today!

Hope-Hauptman
Regular Contributor

Unfortunately I don't know how to write python code. The drainage class looks promising - I will give it a try. Thank you very much. 

Again, what are you trying to accomplish with this? 

- Sorry I did not see this earlier. Well, I am just doing an initial data analysis but I want to understand if there is a positive correlation between well contamination concentration (around a zone of interest) and soil type.  

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Something is missing. How is your current requirement different from ArcGIS Pro determine dominant land use type around each point in a given area (500m buffer) that you posted last month?



Think Location
curtvprice
MVP Esteemed Contributor

Jayanta, the difference is now the input zone values are text, not integer (see my previous post). The land use codes were integers (Value field), the soil type values are in a text field in the raster table.

Hope-Hauptman
Regular Contributor

Great question. Last month I also used Zonal Statistics as Table tool to calculate majority land use but the VALUE field was the land use code (see screenshot last month). Now with my current problem the VALUE field is not what I want to calculate my statistics on. I want hydrologic soil class. Do I need to title it VALUE instead?  Another suggestion was to use the lookup tool but that did not work... Not sure what I am doing wrong. Sorry I know this is a repetitive question and I thought I had this problem solved last month...

 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

I don't have a similar data to test. Could you add just the buffer layer and the Clipped Raster layer on map, and create a map package? Share the map package through a Google Drive, Dropbox or FTP link.

Let me have a look at the data.



Think Location
curtvprice
MVP Esteemed Contributor

Remember, you can only do statistics on number codes not text codes, that is the root of your issue.

When I look at your raster I think the easiest approach is to use the Lookup tool with your raster as input, and specify the text field HYDROLGRP_DCD. This output raster from the Lookup tool will have a unique Value field (an integer) and your text field in it.  Run your Zonal Stats As Table on this using the Value field. Then you'll have the majority soil code (as the Value integer). To add the soil text code to the zonal stats table, use the Join Field tool with your zonal output as the input table, input field Value, the raster table (with Value and HYDROLGRP_DCD) as the join table, join field MAJORITY. This will add your soil codes into your zonal stats results.