Merge Raster data (table) with shapefile of counties

4089
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
19 Replies
RobertFord1
Occasional Contributor
Okay so here is a link to the layer package with my data. Hopefully this works for anyone that downloads it!

If it doesn't, it would be great to know so I can figure out how to make it! 🙂

https://docs.google.com/file/d/0B_RLQsI9g3GWbUFDOGR4dkM4VWM/edit?usp=sharing
0 Kudos
EricRice
Esri Regular Contributor
Hi Rob,

Thanks for the data. I did a quick test using the workflow I described earlier and got exactly what I said we'd get.  What sp are you using with v10.0?  I am using 10.1 sp1 (the latest release).

-Eric
0 Kudos
EricRice
Esri Regular Contributor
One more thing since you're on an old release.  The name of your raster indicates it was the result of a clip operation.  I believe in your version, the table is not automatically updated and even records that were clipped off are still in your table with counts set to 0.  For example, in the data you sent, the raster has Barley with a significant number of pixels in the count column, but when I do zonal on it I get 0 for every county.  You should probably run the Build Raster Attribute Table tool to get an up to date raster attribute table before running Zonal Histogram.  It will make your output table look cleaner and won't be filled with 0's like in my last screenshot.  Back up/ copy your raster before rebuilding the table.

Best,
Eric
0 Kudos
RobertFord1
Occasional Contributor
Eric,

Thanks again. I am using sp5 (the latest from what I can tell). I will try it out again later this afternoon and get back to you. Also, I am assuming the numbers in the table represent pixels correct?

I am comparing this acreage with another websites (http://nassgeodata.gmu.edu/CropScape/) that also lists pixel counts per county (screen shot of Lucas County, Ohio attached). The tables don't seem to match up if it is pixel counts.

Again I will mess with it some more this afternoon and get back to you.

Sorry I keep complicating the issue!

I can't thank you enough!
0 Kudos
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!
0 Kudos
EricRice
Esri Regular Contributor
I hadn't rebuilt the table before running zonal for that screenshot.  The numbers are definitely counts, not acreage or some other unit.

Eric
0 Kudos
ErikOlson
New Contributor II
Rob or Eric,

I'm wondering why Tabulate Area wouldn't have worked for what you were trying to do. Wouldn't it produce the same table?
0 Kudos
RobertFord1
Occasional Contributor

Tabulate area does not produce the table format I want.

Now I have another issue. Zonal Histogram seems to ONLY work for certain files. I am attempting to do this for a few states and only certain states are working.

Let me note that all of the states are in a geodatabase with the same formatting. All of the rasters are in a separate geodatabase with the same formatting.

My question is why on Earth will Zonal Histogram only work for certain states (polygons)? Formats are the same. File Locations are the same.

0 Kudos
JeffreySwain
Esri Regular Contributor
The morphology of the counties is probably causing the issue.  Depending on your data, that is what I would look into.  Also per the help documentation,

If the zone input is a feature dataset, a vector-to-raster conversion will be internally applied to it. To ensure that the results of the conversion will align properly with the value raster, it is recommended that you check that the extent and snap raster are set appropriately in the environment settings and the raster settings.

Since the internal raster must have an attribute table, an error will occur if one was not created in the conversion. If this happens, convert your feature dataset directly with Feature To Raster, Polygon To Raster, Point To Raster, or Polyline To Raster. Generate an attribute table for it as described in the previous tip and use the resulting raster as your Zone input.


Also depends on how much NoData is covered by your zones.
0 Kudos
EricRice
Esri Regular Contributor
The zones are counties Jeff, and there isn't a state in the union with more counties than the maximum unique values to render so it should be building a table during the conversion.  At this point, I would suggest Rob contact Esri Support and have an analyst go through it with him.  Rob posted this same question to the GP forum but included more details in that thread, specifically about the background gp process failing with error messages.  The first test is obviously running it in the foreground to narrow the issue down. After that, I would do what you suggested and convert the zones into raster datasets and run it again, to narrow down the issue some more. Support will know what to do in terms of other troubleshooting.

Best,
Eric
0 Kudos