Select to view content in your preferred language

tools that require layers as input

662
3
11-09-2012 07:32 AM
KatSuda
Emerging Contributor
Hi,
I'm working with rasters in ArcGIS 10.0 and trying to automate several processes over hundreds of files.  Two of the geoprocessing tasks that I want to do are "slice" and "apply symbology".  I am slicing one-band rasters to two classes using natural breaks and hope to get NoData and a value. I have created layer files to apply different colors to the different values.

Since I have written the code to convert the rasters to raster layers for the "slice" operation, it seems clumsy to repeat that conversion on the output of "slice" in order to then use the "apply symbology" process.  Is it possible in coding "slice" to create a layer as the output right away?  Or is there a better way? 
Thanks.

krs
Tags (2)
0 Kudos
3 Replies
MathewCoyle
Honored Contributor
In a word, no. You must create an output raster since a layer simply points to the data. However, you should be able to create a temporary raster in the "in_memory" workspace, if this is simply intermediate data, and create a raster layer referencing that raster. Not all tools support in_memory feature classes/rasters as inputs or outputs. Off the top of my head I'm not sure if slice does or not.
0 Kudos
curtvprice
MVP Esteemed Contributor
Since I have written the code to convert the rasters to raster layers for the "slice" operation, it seems clumsy to repeat that conversion on the output of "slice" in order to then use the "apply symbology" process.  Is it possible in coding "slice" to create a layer as the output right away?  Or is there a better way? 


Just to reiterate - it is not a conversion - a layer is an object that points to the dataset.  Creating a raster layer only takes a moment to do. Most raster tools accept either raster layers or rasters as input.

I'm assuming you're writing a script tool - if the output is your sliced raster, you don't need to do this in code. Just set up your output raster as an output parameter, and set that parameters output Symbology property to point to your .lyr file. Make sure your slice output is saved to that output parameter path.
0 Kudos
KatSuda
Emerging Contributor
Thanks to you both.

krs
0 Kudos