1

Just started using arcpy on ArcMap 10.2.2

Some modules - eg Hillshade - do not accept output raster names as parameters. I want to be able to specify the name of the output raster that appears in the ArcMap session's Table of Contents AND the geodatabase I'm currently working in. At the moment I'm using this method:

> # Some environment settings:
> import arcpy
> from arcpy import env
> from arcpy.sa import *

> # set geodatabase
> env.workspace = "path\to\my\Scratch.gdb"

> # Prevent output adding to the map
> env.addOutputsToMap="FALSE"

ESRI Help http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000v0000000 suggests setting the out_raster as a variable then saving output to workspace...

> myRaster== HillShade(inRaster, azimuth, altitude, modelShadows, zFactor)
> myRaster.save("path/to/my/place")

BUT the name myRaster is not applied to the file saved in the geodatabase. Instead it is the 'auto generated' raster name applied by ArcMap. If env.addOutputsToMap="TRUE" then the raster name is set to myRaster and added to the map but in the gbd is the auto name.

I find it hard to believe there is no functionality to do what I'm trying to do.

thanks

mark
  • 537
  • 6
  • 25
  • What is the inRaster value? I usually source any feature class or raster to is absolute location and if it needs to be added to Arcmap I use [Add Layer](http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000008000000) – NotARobot Apr 15 '15 at 23:53

1 Answers1

0

addOutputsToMap is a Boolean property. Set it to False.

> env.addOutputsToMap = False
DWynne
  • 136
  • 7