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%??

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 22, 2014 at 18:37

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!

answered Apr 22, 2014 at 18:50
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. Commented Apr 22, 2014 at 19:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.