AnsweredAssumed Answered

Loading a raster into a dataframe in arcpy

Question asked by manuelgimond on Feb 4, 2011
Latest reply on Feb 7, 2011 by manuelgimond
When attempting to load a raster (created in arcpy) using arcpy.mapping.AddLayer, I get the following error message:

<type 'exceptions.AssertionError'>

Here's a snippet of the code:

env.workspace = arcpy.GetParameterAsText(0)
YmapFile      = arcpy.GetParameterAsText(4) # Output filename
YMAP = arcpy.NumPyArrayToRaster(YmapArray,lowerLeft,pixSize,pixSize)
mxd = arcpy.mapping.MapDocument("CURRENT")
df    = arcpy.mapping.ListDataFrames(mxd)[0]
arcpy.MakeRasterLayer_management(YmapFile,"Y Map")
arcpy.mapping.AddLayer(df,"Y Map", "BOTTOM")

The raster is properly created and saved in the folder/geodatabase defined by env.workspace.

Also, I can load the raster layer using the arcpy.SetParameterAsText() function (when the parameter is set as a derived entity in the scipt's properties option box), so I know that the layer is being properly created.

Any suggestions?