Merge Raster data (table) with shapefile of counties

4090
19
Jump to solution
02-18-2013 09:25 AM
RobertFord1
Occasional Contributor
Hi all. Thanks for any response in advance.

My question is this: I have a raster image that details land use data for a state (Ohio). I also have a shapefile of all Ohio counties. I want to be able to export a table that has the raster values for each county listed. Basically, I need to query every county in the state. I've attached a ZIP file with 2 pictures and a layer file that contains the raster data and shapefile I am working with.

I would consider myself an advanced-beginner with ArcGIS, so forgive any naivety on my part.

Thanks for any and all help!
0 Kudos
1 Solution

Accepted Solutions
RobertFord1
Occasional Contributor
eric,

Tried your workflow again but this time I added the Raster file to a personal geodatabase and did the Build Raster Attribute Table tool.

Worked like a charm now. Not sure why it didn't like not being in a geodatabase.

Finally got a table with a label column! But the values do no match the ones in your screenshot for some reason. Table is attached.

Again, do these numbers represent pixels, acreage, or some other attribute?

At least I finally figured out the original problem so thanks again!

View solution in original post

0 Kudos
19 Replies
RobertFord1
Occasional Contributor

Basically, as an example, I want to know how much land is covered by forest, corn, and soybeans in every county for Ohio based on the raster image. Thanks again!

0 Kudos
EricRice
Esri Regular Contributor
Hi Robert,

You should check out the Zonal Histogram tool.  Your zones are the counties and the value raster would be your landuse raster.  This tool will give you the breakdown of each landuse within each zone.

Best,
Eric
0 Kudos
RobertFord1
Occasional Contributor
Thanks, but I have tried this method and it does not produce what I need. The resulting table does not tell me what the resulting values even stand for. I have attached what the outcome of this method is.

However, the table does have the format that I need. (IE values for every county in the state)

Thanks for the reply!
0 Kudos
EricRice
Esri Regular Contributor
Hi Robert,

I personally dislike the formatting of the output table, but it's not hard to get the landuse descriptions back.  All you would have to do is join the output table back to the raster attribute table.  The output table has a field called LABEL which you can use to join back to the VALUE field in the raster. Once this join is in place you'll have landuse descriptions back.  Since each zone becomes a field, you can't really expect to join this back to the original polygon zones. 

I have an alternative workflow where you convert the landuse raster to polygons and run the Tabulate Intersection tool (new at 10.1) then I usually follow that up with the Pivot Table tool before joining the table back to my polygons.

Best,
Eric
0 Kudos
RobertFord1
Occasional Contributor
Hi Eric,

Thanks for the reply again. I currently only have access to ArcGIS 10 not 10.1.

I tried the join and got the resulting table attached. Also, there is no "LABEL" field in any of the tables I am working with so I'm not sure what you mean here. The table that was created is not correct as it shows cotton grown in the county, which cotton is not grown anywhere in Ohio.

I appreciate the help!

Best,
Rob
0 Kudos
EricRice
Esri Regular Contributor
Robert,

We will get this sorted out together...

Originally, I assumed you were symbolizing the landuse raster using Unique Value rendering and thus the zonal histogram table's label field would have the unique values for the raster in that column and require joining the zonal output table back to the input value raster table where Label = Value to establish/retain the landuse descriptions.  I found that if you symbolize by Unique Values, but use the description field for the value field (on symbology tab) rather than the Value field, when you run Zonal Histogram the label field will automatically contain the descriptions your looking for so no further join is required.  Please see screenshot-1 of result I obtained with this method.

Based on the table you sent and lack of label field, I do not believe you are using the Unique Value renderer.  My example case is simple with only 7 landuse categories so ArcMap automatically uses Unique Value, but if your data has more than 26 unique values (and it does) then ArcMap will display it with a stretched renderer.  If you leave it as stretched, AND your inputting a raster layer (rather than a raster dataset) then the layer's symbology defines the number of classes.  When it's stretched you get 256 classes so most of your landuse will be zero's for each county.  Hopefully this second screenshot helps clarify what is happening.  The table on the left is Zonal Histogram with the Unique Value renderer and the table on the right is with Stretched.  What you see is that the value 7 was stretched to 256 - county 1 still has 447 pixels of wetlands and county 2 has zero, but clearly using stretched is not the way to run this tool since the values for each landuse are stretched to the full 8 bit range and aren't really meaningful in terms of properly being able to join it back to get descriptions.  This is how you got cotton growing in Ohio! The stretched value was joined, not the real value.  😄

To summarize:
1. Use the Unique Value renderer on the landuse raster.
2. On the symbology tab, set the value field to the landuse description field like in screenshot-3. My description field just happens to be called Landuse.
3. Run Zonal Histogram.

This should produce what you're looking for without further joins.

Best,
Eric
0 Kudos
RobertFord1
Occasional Contributor
Eric,

From your images, I see that my original data that I provided was not accessible. If you private message me your email, I can share a layer package with you via Google Drive (it's too large to upload here 15 MB +).

Also, my data is already displayed the way you say and show, but I still cannot figure out how to get the landuse descriptions back. I still just get the table like before.

Thanks again!
0 Kudos
RobertFord1
Occasional Contributor
Also, attached is a screen capture of what I am doing with the Zonal Histogram tool, the raster table and symbology, and the resulting table again.
0 Kudos
RobertFord1
Occasional Contributor
Eric,

So after playing around, I noticed if I change the symbology value field from "Class_Name" to "Value", Zonal histogram will output the labels column into the table (attached), but they still do not mean anything. If I try it with the "Class_Name" instead, I get the following message:

"Background processing has encountered a serious error and is unable to continue."

Thanks again for all of your help and  patience! 🙂
0 Kudos