I'm trying to make a slope raster from a lot of DEM`s.
The DEM rasters are in this file Geodatabase
C:\Bachelorarbeit\Daten\GIs\Originale\dtk25_dgm1.gdb
The slope raster should be saved in this file Geodatabase
C:\Users\Hans im Glück\Documents\ArcGIS\Default.gdb
Is it possible to use spaces in my pathname?
I have ArcGIS 10.3 and found this basic script on ESRI's website:
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outSlope = Slope("elevation", "DEGREE", 1)
outSlope.save("C:/sapyexamples/output/outslope01")
How to I execute this script on multiple DEM's contained within a folder?
1 Answer 1
As your DEM data is in a file geodatabase then you will note 3 things about the file names:
- They do not start with a number
- They do not have spaces in their names
- They are unique names
As @Paul says in the comment you can create a list and loop through this. You could just use the name of the DEM for the output name of your slope raster, that would be simplest but it may be prudent to change it in some way to indicate it is a slope raster. You could easily do that at the point when you save your raster.
for
loop.