Select to view content in your preferred language

Raster to Polygon within Model - inline variable error

7080
10
01-05-2015 03:57 PM
JenniferRoath
Deactivated User

I created a model to iterate through and process rasters and convert the desired value field to a polygon. The final model needs to be robust and very user friendly.

However, when I try to use an inline variable to put the polygon into a user defined temp geodatabase the tool will add ".shp" to the output file name. Unless it is pathed to a gdb in the model it will add the ".shp" But since the output is really a gdb, it causes an error during the run.

The problem:

I've been getting around this by making the polygon output into a parameter and changing the location myself each run. But then it's not exactly user friendly.

How I "fix" the problem:

How can I prevent the automatic addition of ".shp" on this step? And leave out my work-around solution so the eventual user only defines a temp gdb?

(None of the other steps have this issue with the inline variable)

Thanks

10 Replies
XanderBakker
Esri Esteemed Contributor

Maybe you should write to the in_memory workspace: ArcGIS Help (10.2, 10.2.1, and 10.2.2)

0 Kudos
JenniferRoath
Deactivated User

The files are too big and it kept crashing in memory. Using a defined gdb stopped the crashing but then it wouldn't let me use the location as an inline variable.

0 Kudos
XanderBakker
Esri Esteemed Contributor

The alternative is to include a file geodatabase in the model, using he proposed folder structure by Esri:

ArcGIS Desktop

0 Kudos
JenniferRoath
Deactivated User

I am using a file geodatabase. The problem is that when I tell the "raster to polygon" tool to create the output polygon features as %temp%\%val%_poly it will append .shp to the file name. However, %temp% is a geodatabase and doesn't allow .shp

I've been getting around this by setting the output as a parameter and telling it to create the feature as E:\temp.gdb\%val%_poly each time I run the model.

My final version can't ask the user to include an inline variable.

0 Kudos
MikeCusi
Frequent Contributor

Maybe you could use the "Model Only Tool" - Parse Path to get rid of the .shp

0 Kudos
JenniferRoath
Deactivated User

%val% is already a parsed path variable. The tool itself will append .shp to the file name if it doesn't read .gdb in the file path. This happens when I set up the tool in the model and have only been able to change it manually as a parameter later when I try an run it.

0 Kudos
JenniferRoath
Deactivated User

Ok - I found a solution (posting in case someone reads this later with a similar problem)

1) Model parameter = Results Folder (not a gdb like I had it set up to do)

2) First Step in the model - create "Temp" GDB in the user defined Results Folder

3) In the raster to polygon tool, have the output feature polygon be %Results_Folder%\Temp.gdb\%val%_poly

The tool requires the output path to have .gdb or it will append .shp to the name. This accomplishes that without having to manually change the path.

Thanks everyone for the help!

0 Kudos
BrunoMartins1
New Contributor

I have the same problem but I did not understand your solution quite well. Could you give post a screenshot of your model? Your solution is the only one that I know.

0 Kudos
MarinelDegones
Emerging Contributor

Hello Ms. Jennifer Roath, I have similar problem to what you posted last year. The shapefiles in my ModelBuilder like for example in my attached image, the raster to polyline is having an error when I run the model. Based on your posted solution, I should have create a folder that is not inside the File Geodatabase am I right? Thank you.

0 Kudos