Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

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!

share|improve this answer
    
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. –  geonhetrick Apr 22 at 19:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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