Raster Generalization - Expand, Shrink - not working

2686
12
05-19-2017 10:28 AM
BobChristensen
Occasional Contributor

Hi, I am trying to use the raster generalization tools "expand" and "shrink" but the operation fails. I have been successfully using the majority filter tool on the same data in the same project. Here is an example message from the failed expand process:

Messages
Executing: Expand C:\Users\Bob\Documents\ArcGIS\Default.gdb\hm124mf84rc D:\Default.gdb\Expand_hm1241 10 50000
Start Time: Fri May 19 09:18:08 2017
ERROR 999999: Error executing function.
The table was not found. [VAT_Expand_hm1241]
("esriDataSourcesRaster.RasterWorkspace") Failed to create raster dataset
ERROR 010032: Unable to create the scratch grid C:\Users\Bob\AppData\Local\Temp\arc3AEA\t_t963.tif. Expand failed
ERROR 010067: Error in executing grid expression.
Failed to execute (Expand).
Failed at Fri May 19 09:20:21 2017 (Elapsed Time: 2 minutes 13 seconds)

Please help.

0 Kudos
12 Replies
DanPatterson_Retired
MVP Emeritus

table not found indicates that perhaps it is a floating point grid... which has no table.  Perhaps you can specify the values you used in your parameters.  And is this a projected raster? I would also shorten the file name since it looks like the output is going to a grid and it looks like you are at the limit for grid file names, (destination location should have no spaces either)

0 Kudos
BobChristensen
Occasional Contributor

Hi Dan, thanks for the reply. 

How do I determine whether it is a floating point grid? The raster has a projection defined, but did you mean something else by a "projected raster"? 

0 Kudos
DanPatterson_Retired
MVP Emeritus

Well... you can check the raster's properties by right-clicking on it in the table of contents and selecting properties, then click around.  Alternately, r-click and see if you can open the table... if it is greyed out it is a floating point raster... aka ... no table raster. 

A raster can have a coordinate system defined, it will either be a Geographic Coordinate System, GCS, or a Projected Coordinate System (PCS). GCS's have units of decimal degrees... pretty useless for most analytical things or most things requiring area, distance, length useage.  PCS's have units of meters (except in the U.S. for the most part, still on the feet ).  So when you specify the number of cells to expand (shrink) you should know that 1 cell is equal to X meters since you probably have no idea what 0.00833333 degrees represents (and it is not a constant either).

Once you can ascertain what type of raster data you are working with, then Expand and Shrink will work as designed if you adhere to basic rules and are aware them (no spaces in paths, keep paths short, keep file names short, if you want anything other than an ESRI grid, then you have to specify an file extension.... I could go on, but I won't)

Report back if you are having difficulties still.

0 Kudos
BobChristensen
Occasional Contributor

Thanks again Dan. The grid has a table that I can pull up by right clicking. 

This is the projection info:

NAD_1983_StatePlane_Alaska_1_FIPS_5001
WKID: 26931 Authority: EPSG

Projection: Hotine_Oblique_Mercator_Azimuth_Natural_Origin
False_Easting: 5000000.0
False_Northing: -5000000.0
Scale_Factor: 0.9999
Azimuth: -36.86989764583333
Longitude_Of_Center: -133.6666666666667
Latitude_Of_Center: 57.0
Linear Unit: Meter (1.0)

Geographic Coordinate System: GCS_North_American_1983
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_North_American_1983
Spheroid: GRS_1980
Semimajor Axis: 6378137.0
Semiminor Axis: 6356752.314140356
Inverse Flattening: 298.257222101

Is that a GCS projection then?

0 Kudos
DanPatterson_Retired
MVP Emeritus

No a PCS NAD_1983_StatePlane_Alaska_1_FIPS_5001

So check its properties and determine the cell size and units (could be feet in Alaska with stateplane projection)

Now when you want to expand/shrink you specify the number of cells (if memory serves).  If your purpose is to get rid of 'fiddly bits' in the raster, then shrink it by 1 cell or so and that will get rid of single cell or really small areas.  You have to play with the order sometimes and the values to shrink or expand.  

Other methods to get rid of 'junk' is a combined use of regiongroup and nibble.  This works well if you don't have a ridiculously large number of zones.  The nice thing with regiongroup'ing a raster is you can then query and get rid of 'zones' regardless of value, based on the area (ie number of cells).  If you have a minimum group of 1 acre, you can identify those, convert to null then 'nibble' in the surrounding values to fill the void.

Other options include filtering... but that can affect everything and not just things you want to target.  I consider that the 'lazy' method, (ie keep changing window size/shape and filter method, until 'stuff' goes away')... but that is just my opinion.

In short there is no 'correct' way of doing what you want to do... except for the error thing, but that could just be your parameter specifications and/or workspace settings.

0 Kudos
BobChristensen
Occasional Contributor

The linear units for the grid are meters. 

I really appreciate your I input here. It sounds like you know how to do what I am trying to figure out. I am cleaning up a supervised classification of orthoimagery. The main problem I have is shadows. I have large areas of shadows on the north sides of mountains, medium areas of shadows on the north sides of taller trees, and small areas of shadows in between tree tops. I am currently working on the medium and small areas of shadows. It would be ideal if I could tell ArcGIS to take all medium area and smaller patches of shadow (> 50 square metes) and nibble them away by replacing with the values to the immediate north, but I have not figured out how to do that. 

You caught me being lazy. I have been using majority filter to clean up the small, in between shadow areas. That works OK but really does not alter the stats as much as I expect fixing the medium and large shadow areas would. Thus I am trying to figure out how to use the shrink and expand tools. 

I also have LiDAR data for the area and have been experimenting with using canopy heights to take an educated guess at classifying the large shadow areas, as well as tweak some of the miss-classified areas based on basic topographic characteristics like coastal, floodplain, and uplands. 


I will study the regroup approach but I would sure like to figure out what is going on with my shrink and expand errors.Does it sounds like the issue might be my workspace settings? I am using a geodatabase that is preceded by no empty spaces in the path. Not sure what else this tool needs and like I said above, I have been using the majority filter generalization tool with success so I am confused about what shrink would need that is different from majority filter.

0 Kudos
DanPatterson_Retired
MVP Emeritus

what is the cell size and what were the shrink/expand values you used. 

It also might be a good time to try saving the resultant out to an esri grid in a real folder... this issue has surfaced a few times recently.  

I will think more, but the pesky shadow thing... this is where human intervention into the classification process comes into play (ie texture and spatial association... I bet those trees look the same in the shadow or not).

Keep me posted and provide those details if you can and try in a folder as an esri grid or a tif (you need to put the file extension *.tif on the output BTW)

0 Kudos
BobChristensen
Occasional Contributor

Thanks again Dan. 

The cell size is 1 meter. 

Today I tried the operation using arcgis pro and the error was a bit more verbose, I think. It looks like it is a permissions issue with the scratch space. Still confused because other operations that use the scratch space work fine. Both the grid I am running the expand process on, and the output I am selecting are geodatabases. Should I try saving to a simple folder? IS that what you mean by a "real" folder?

Start Time: Tuesday, May 30, 2017 5:58:44 AM
ERROR 999999: Error executing function.
The table was not found. [VAT_Expand_HM1242]
("esriDataSourcesRaster.RasterWorkspace") Failed to create raster dataset
ERROR 010032: Unable to create the scratch grid C:\Users\Bob\AppData\Local\Temp\ARCGIS~1\t_t363.tif. Expand failed
ERROR 010067: Error in executing grid expression.
Failed to execute (Expand).
Failed at Tuesday, May 30, 2017 6:29:50 AM (Elapsed Time: 31 minutes 4 seconds)

0 Kudos
BobChristensen
Occasional Contributor

And here is the error if I try to save the output to a C:\temp

Start Time: Tuesday, May 30, 2017 7:12:00 AM
ERROR 999999: Error executing function.
("esriDataSourcesRaster.RasterWorkspace") Failed to create raster dataset
ERROR 010032: Unable to create the scratch grid C:\Users\Bob\AppData\Local\Temp\ARCGIS~1\t_t367.tif. Expand failed
ERROR 010067: Error in executing grid expression.
Failed to execute (Expand).
Failed at Tuesday, May 30, 2017 7:43:11 AM (Elapsed Time: 31 minutes 10 seconds)

0 Kudos