# Process: Natural Neighbor outpath = Output_GDB arcpy.env.workspace = outpath arcpy.gp.NaturalNeighbor_sa(v_route, pmname, v_raster ) v_raster = os.path.join(outpath, v_raster) # Process: Make Raster Layer outpath = Output_GDB arcpy.env.workspace = outpath arcpy.MakeRasterLayer_management(v_raster, v_conc) arcpy.SetParameterAsText(6, v_conc)
Solved! Go to Solution.
What am I missing to get my Raster Layer in the right place on the TOC?
# Process: Natural Neighbor outpath = Output_GDB arcpy.env.workspace = outpath arcpy.env.scratchWorkspace = outpath from arcpy.sa import * v_raster = NaturalNeighbor(v_route, pmname) v_raster.save("nnraster") # saves to outpath + "/" + "nnraster" arcpy.SetParameterAsText(6, v_raster)
What am I missing to get my Raster Layer in the right place on the TOC?
# Process: Natural Neighbor outpath = Output_GDB arcpy.env.workspace = outpath arcpy.env.scratchWorkspace = outpath from arcpy.sa import * v_raster = NaturalNeighbor(v_route, pmname) v_raster.save("nnraster") # saves to outpath + "/" + "nnraster" arcpy.SetParameterAsText(6, v_raster)
It worked! I was surprised since the scratch workspace was already set to the correct file GDB in ArcMap, and since the raster itself already (apparently) resided in that GDB, according to ArcCatalog.
That sounds strange. Script tools should pick up the geoprocessing environment settings unless you set it explicitly within the script. However, it's a huge advantage to set it in your script so you can for example, ensure your scratch workspace is a folder rather than a gdb. Any changes to these GP environment settings inside a script tool do not migrate "up" to the application, they only apply to your script.
I'm wondering if your script is running "in process" or not. I wouldn't think it would make a difference.