I am trying to run the Zonal Statistics as Table tool on my data in order to sum the number of cells of a certain type of landcover in each county. For example, I want it to sum how many Deciduous forest, Pasture/Hay land and etc.. there are in each county individually.
I have tried two different ways: 1. By using the Extract by Attributes tool on the raster to extract each individual type of cell (so, one raster is created for deciduous forest cells and one raster for paster/hay and etc...), then running the zonal statistic on each of those one at a time (not sure if this is necessary or not). 2. By just running the Zonal statistics as Table tool on the full raster.
I have tried EVERYTHING (saving it in a personal geodatabase, saving it in a file, getting rid of spaces in file names, making sure zone feature name is less than 17 characters etc...) and I still keep getting either "ERROR 999999" or there is no error at all under messages or even an indication that it has stopped, instead the red X circle just appears next to
it with no message. I attached a screenshot of what that second occurrence looks like.
Does anyone have any idea what I might be able to do to make this tool work? And do I need to be performing the "Extract by Attributes" tool or should the Zonal Statistics tool be able to sum up each type of cell (e.i. deciduous forest, developed land etc..) individually in each county?
from your screen grab...
there appear to have spaces in the file names and (Tiger....)
what is the field with the period in it? it suggests a join on the table (not good)
input value raster (no file extension... what is it? not an esri grid for sure
Z folder... is that a network drive? a remapped drive? not a usb or some other non-local drive
Did you try a small sample of the data (split some pieces out to rule out memory issues)
- I went back and changed the file names to have "_" instead of spaces, the one you see is just me having edited the name in properties to be more readable.
- Yes, I joined tables together to match my Lyme disease case numbers with the county shapefiles, is that a problem for trying to perform a zonal statistic? If so, how should I go about fixing this and getting the Lyme case data and population data matched with the shapefile?
- No its not from esri, the input value raster was downloaded from the National Land Cover Database (NLCD).
- Yes, the Z folder is a server that I am doing all of this work on because I am working on a university computer, is that a problem for this tool? I can move it to the computer and then move it back to the server before I shut down the computer. Will that cause any issues or just involve restoring the pathnames?
- I tried the normal (non-table) Zonal Statistics tool on one county, and it just gave me a black box over the area. I assume that means the tool didn't work. I also tried the Zonal table tool on just one of the cell types, and that also didn't work.
Thank you for all your help!
Did you try to make the file with the join permanent by exporting to a new featureclass, then copy it to a local folder with a simple path (ie c:\test) You have to simplify the process and joined data, complex paths, networks and files that are too big just complicate issues. Give it a go
Yes I did exactly that, shortening file names and making the join permanent by exporting it to a new feature class, except I kept it on the outside server in the same folder as the main map, and the tool luckily still worked. Thank you!
Good... You might want to close the thread Kate, before you get any more advice good luck with your studies
I will do that! I have one more question if you don't mind, I want to tell the Zonal Stat tool to only count cells that are completely inside a county, not ones that are only half inside a county (in other words exclude raster cells in the SUM that are split by the county boundary line). However, I do not see an option for this in the Zonal Stat tool window. Do you have any idea how I could accomplish this?
That isn't how a raster cell works... the center of the cell is inside... or not... don't get carried off by the visual representation of the square, it is the centre that is used.
Oh I see. So, that means that a cell "split" by a county line will only be counted in the sum of one of the counties and not both, because the center can only fall inside one county (zone)?
That is correct! Since the zones are converted to raster first, a pixel can only be part of a single zone. If you set the environment setting to match the cellsize and snap raster to the raster the you want to extract the statistics from, you will have no problems. Convert the zones to raster first if you want to have a better control of how a pixel is assigned to a zone.