I'm trying to run slope analysis in ArcGIS. I have written an ArcPy script that converted feature layers to raster files. Now I have a list of rasters (each with a unique name) in the table of contents and I need to run slope analysis to create new rasters for each one. I've written a script that works, but only on the raster at the bottom of the list in the table of contents.
Here is my script:
import arcpy import os from arcpy import env from arcpy.sa import * # Set the current workspace in_workspace = r"E:\DEM Files" out_workspace = r"E:\DEM Files" MXD = arcpy.mapping.MapDocument("Current") DF = arcpy.mapping.ListDataFrames(MXD, "Layers") rasters = arcpy.ListRasters("*", "TIFF") for rasters in DF: # Set local variables inRaster = rasters outMeasurement = "PERCENT_RISE" zFactor = 1 # Execute Slope outSlope = Slope(inRaster, outMeasurement, zFactor) outSlope.Save() MXD.save() del MXD`