# Subtracting out slope (in general) of DEM using ArcGIS for Desktop?

I'm searching for a solution process to subtract out the slope of a DEM like this:

I have a high resolution DEM and want to reconstruct historical/old/not active parts of a river. The problem is the trend of the whole area. Structures from different areas are at different highs and its not possible to describe/visualize the whole area in the same way. So my idea is to adjust all highs to solve the problem.

Any idea?

• How do you want the slope to be calculated? Just one plane over the whole area? – underdark Jan 2 '15 at 17:28
• You need to be able to define how your red line should look like. Luke's answer is a good idea but the trend surface is not going through the local minima. So it is important that you identify the type of trend surface that you need. – radouxju Jan 2 '15 at 19:45
• @radouxju the trend line can be shifted down to avoid negative values by adding the minimum value. – user2856 Jan 2 '15 at 23:13
• What are you trying to accomplish? The best approach may depend on whether you are interested in detrending the peaks or the valleys or the mean (as in the answer below) – haresfur Jan 3 '15 at 7:01
• I want it calculated over the whole area. I have a high resolution DEM and want to reconstruct historical/old/not active parts of a river. The problem is the trend of the whole area. Structures from different areas are at different highs and its not possible to describe/visualize the whole area in the same way. So my idea is to adjust all highs to solve the problem. (this should be within my question, sorry!) – Reen Jan 5 '15 at 11:56

Subtract the trend surface from the DEM.

Linear trend (1st order polynomial)

2nd order polynomial trend

Per @radouxju's comment - the trend line can be shifted down to avoid negative values by adding the minimum value.

In the Raster Calculator:

``````"DEM" - Trend("DEM") + N
``````

Where: N = Minimum raster value

In python

``````import arcpy
from arcpy.sa import Trend, Raster
dem = 'c:/data/elevation.tif'
demmin = arcpy.GetRasterProperties_management(dem, "MINIMUM").getOutput(0)
dem = Raster(dem)
result = dem - Trend(dem) + demmin
result.save('c:/data/detrend.tif')
``````
• Elegant approach – If you do not know- just GIS Jan 3 '15 at 2:00
• @Luke My comment was about the question: your answer was good and it is now even better (already +1). I was just asking the OP to think about his needs, because your method would not give exactly the same results as a trend surface on the local minima. By the way, you can replace N by "DEM".minimum in your raster calculator expression (see gis.stackexchange.com/questions/116910/…) – radouxju Jan 3 '15 at 20:44
• this sounds very good so far! thank you! if i want to use the ordinary tool "trend" i have to set the order of the polynomial. How I know which order of the polynomial is most suitable for my DEM? Is there any trick to analyse the DEM in a fast way before i start the trend-tool? The description of the tool says the order with the lowest RMS-error fits best. Does this mean I have to test the different orders? Is there a possibility to set the order and get the RMS-report within the raster calculator too? – Reen Jan 7 '15 at 15:47
• @Luke It seems my DEM is too big (1m-DEM, 26gb) and it's not possible to convert the raster into (multi)points correctly,which i need for the trend operation. I've had the idea to split the DEM,do the conversion for each part and to unite the points before the trend tool.But i'm afraid that's a procrastination of the actual problem only.I've tried QGIS too but with no success atm.Maybe you have an idea to handle the whole issue in a different way?I wonder if there is a possibility to do a kind of "wax impression" of the terrain?Maybe similar to a hydrological tool? – Reen Jan 9 '15 at 14:45
• @Reen Resample DEM to a lower resolution, derive trend, resample trend back to high res and subtract from DEM might work. – user2856 Jan 11 '15 at 6:44

Didn't notice this was an old post that got edit-bumped until I'd written all this out, but oh well:

Trend surface is good. The closest tool I can think of to OP's sketch is SAGA-GIS' 'Standardised Height' in the tool 'Relative Heights and Slope Positions'. This basically normalises your whole raster on a 0-1 scale and then multiplies the original DEM by that factor, but its got some local weighting factors built in that aren't well documented. I've found the default output useful, though.

SAGA also has a few other interesting tools:

• 'vertical distance to channel network' which will give you height above base. You'll need to calculate a drainage network first, so if your DEM reaches the coast then base will be the end of the river, otherwise it'll be the lowest channel cell.
• Topographic Position Index and MrVBF, which are used a fair bit in various landform classification methods, for example here.

Height Above Nearest Drainage is a bit more sophisticated than simple height above base and has been used in combination with slope to classify terrain. The original work was done using some freeware GIS the Brazilian government built, which is kind of a black box. You can get an almost identical result in GRASS-GIS by chaining the `r.stream.extract` and `r.stream.distance` modules. You need a hydrologically corrected DEM for that kind of approach, though.

Another cool GRASS add-on is `r.geomorphons`, which can give you terrain basic shapes (upper slope, flat, footslope etc) very quickly but doesn't give you much info about relative elevation. There's a rather good intro-to-GRASS tutorial that uses it.