2

So I'm building a model to be published as a geoprocessing service, and I'm trying to use the 'Save to Layer File' tool to create a symobolized result of my raster output.

I've set both current and scratch workspaces to separate file gdb's, and am using in-line variables (%workspace%, %scratchworkspace%) to direct my outputs. I want to use the %scratchworkspace% in-line variable for my 'Save to Layer File' output, but to my knowledge, layer files cannot be stored in a geodatabase... therefore, I need to know how I can set the 'Save to Layer File' output to the folder that the scratch gdb is stored in.

Is it possible to specify my .lyr output to be saved "up one level" from the %scratchworkspace%??

1 Answer 1

2

You will have to insert a Calculatate Value tool. In model builder, Insert / Model Only tools / Calculate Value.

In expression, enter:

"\\".join('%scratchworkspace%'.split("\\")[0:-1])

The resulting "folder" will be in the output variable. Default name output_value, but you can change that by renaming the output.

You could also use this Calculate Value tool to output the entire name of your file.

Hopes this helps!

1
  • In theory, that seems like it would work. I ended up just setting my Scratch Workspace as the folder, then using %scratchworkspace%\scratch.gdb\output as my output pathname.
    – noah
    Apr 22, 2014 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.