Problem with Iterations in Model Builder

1653
8
11-20-2016 04:46 PM
Highlighted
New Contributor II

I am trying to convert a large number of raster (integral) to polygons by using the iterations in the model builder, but the model will not operate as expected. It will run for the first file and then errors show on the second iterations. Can anyone help with this problem? Thank you in advance! 

Reply
0 Kudos
8 Replies
Highlighted
MVP Frequent Contributor

I'd start by looking at how your data is stored, as at least by the error message there appears to be some strange things potentially going on.

1.  Iterate Rasters is typically done by iterating rasters in a folder.  One solution may be to copy your rasters to a folder and then run the iterate against that folder.

Summary

Iterates over rasters in a Workspace or a Raster Catalog.

Iterate Rasters—Help | ArcGIS for Desktop 

2.  At least from the path shown in the error message, it almost appears that you have a shapefile stored in a geodatabase.  That's not possible.  Check to see if actually have shapefiles or instead have feature classes in a geodatabase.  If feature classes are being accessed, the filename will not end with .shp.

3.  The geodatabase SLR Results.gdb appears to have a space in the name.  If there is a space, try renaming it with and underscore _ .  It's not well known, but many processes in GIS bomb out if there is a space in anywhere in the path, including the filenames and geodatabase names.

Chris Donohue, GISP

Highlighted
New Contributor II

Hi Chris,

Thank you very much for your prompt response! I tried to clean up all other files in the geodatabase and have only the raster files named "connect_1" to "connect_60". I think there are not other shp files in the geodatabse so that I am not sure why this problem persist.  Now I am trying to simplify the model by only running iterations on converting raster to polygons. The following errors show. Actually, the model worked for the first file "connect_1" and then it would stop by showing the following error. Is there anything wrong with the model I built? 

Reply
0 Kudos
Highlighted
New Contributor II

Chris,

I have tried to move all the raster to another folder with only raster data and have deleted all the spaces in the folder names. However, the same errors show again. It should be a very simple process but I do not know why it cannot work. It worked when I pulled the files from the folder and runed Raster to Polygon function one by one but did not work with model builder. Also, why it is looking for a shp file as all the input file the Raster to Polygon file need is raster files? Thank you very much for your help!

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

The error message is from the output, not the input. You cannot create shapefiles (or any file with a "." in it) inside a geodatabase.

I suggest changing your Raster To Poygon output file name so it will not include .shp in the polygon feature class name. For example, instead of %NAME%.shp make the output using the geodatabase model element in the path like this: %SLR Simulation.gdb%\%NAME%_polygon

Chris is right that you should ALWAYS avoid spaces in any names of objects in ArcGIS.

Highlighted
New Contributor II

Hi Curtis,

Thank you very much for your help! I did not include the "." in my file name originally and it was created by the function itself. Thus, I think the problem might not be due to the inclusion of "." or maybe I am wrong. I tried what you suggested and there were still errors. As I mentioned in my previous post, the model worked for the first file and it started to show errors after the first run. Can you tell what might cause this problem?

Reply
0 Kudos
Highlighted
MVP Frequent Contributor

In regards to the shapefile issue, I did notice this morning when I set up a quick Iterate Rasters that if the result from the Raster to Polygon is sent to a geodatabase it continually tried to add the .shp to the output unless one sent the output to a Feature Dataset within the geodatabase. So in other words if the output is sent to the base-level of the geodatabase, .shp will be added by default (even though this is not correct).  So I'd start by creating a Feature Dataset within your geodatabase and send the output to that.

As to the invalid characters error, at least at first glance I don't see why that is triggering.

Chris Donohue, GISP

Highlighted
MVP Frequent Contributor

I managed to get it to work, but am now puzzled as to why you are getting the invalid characters error.  Can you recheck the paths and file names to ensure that their are no restricted characters being used?  Keep in mind that in the raster-processing world there are severe restrictions on what can be used for filenames, so that may be what is tripping things up. Check to see that all the folders in the path and all file names that have short letter names, numbers, and underscores only.  Also, if numbers are used, make sure they are not the first character in the file name, as this will cause some crashes. 

Chris Donohue, GISP

Highlighted
New Contributor II

I somehow managed to make it work. Not sure what I did wrong before. I now output it to a folder rather than a geodatabase and added "_p" to the "%Name%". Thank you very much Chris for taking the time to help me out. I sincerely appreciate it!

Reply
0 Kudos