MakeRasterLayer, doesn't

Discussion created by jpedder on Apr 13, 2013
Latest reply on Apr 13, 2013 by startch0
From my previous post having trouble writing a raster from a viewshed. I have the viewshed raster writing correctly to my scratch DB, however as much as i try I can't get MakeRasterLayer_management to create a raster file either in the dataframe or to disk.

If I run this line of code from Python geoprocessing inside ArcMap the layer add correctly

ping_layer = 'path to layer in the scratch gdb'

running from a standalone script is does nothing. Here's a code snippet so you can see what's going on. Obviously lots of messages etc for me to see what's going on

# Set enviroment, frames and layers
scratchdb = arcpy.env.scratchGDB
scratchfdr = arcpy.env.scratchFolder
arcpy.env.overwriteOutput = True

if arcpy.CheckOutExtension('Spatial'):
    if arcpy.GetCount_management(inObserverFeatures) != 0:
        arcpy.AddMessage('Ping count is {0}'.format(arcpy.GetCount_management(inObserverFeatures)))
        outViewshed = Viewshed(clippedraster, inObserverFeatures, zFactor, useEarthCurvature, refractivityCoefficient)

        Final_Viewshed ='{0}\Final_Viewshed_{1}'.format(scratchdb,timestamp)

        rQuery = '{0} > 0'.format(arcpy.AddFieldDelimiters(,"Value"))

        if Final_Viewshed:

            arcpy.AddMessage('Found {0}'.format(Final_Viewshed))

            ping_layer = '{0}\PingLayer_{1}.lyr'.format(scratchfdr,timestamp)
            arcpy.AddMessage('ping layer = {0}'.format(ping_layer))

            arcpy.AddMessage('Not there')

Everything appears to work properly other than the MakeRasterLayer

Pretty frustrated at this point, I've tried all I can.