[gdal-dev] Slope in gdaldem
Stephen Mather
mather.stephen at gmail.com
Thu Dec 15 11:49:35 EST 2011
Hi All,
A colleague tipped me off to an article in Forestry Source entitled
"When GIS Slope Isn't What You Think" showing differences between field
measured slope values and GIS results. The differences can be
substantial. The short and long of it is that local hydrologic slope is
closer to what's used in the field by foresters than the integrated slope
from either Horn or Zevenbergen-Thorne.
And so, I have a feature request. I would like to add hydrologic
slope to gdaldem. This is max local slope rather than integrated 9 cell
slope like the existing code:
The existing code for Horn, e.g. is:
dx = ((afWin[0] + afWin[3] + afWin[3] + afWin[6]) -
(afWin[2] + afWin[5] + afWin[5] + afWin[8]))/psData->ewres;
dy = ((afWin[6] + afWin[7] + afWin[7] + afWin[8]) -
(afWin[0] + afWin[1] + afWin[1] + afWin[2]))/psData->nsres;
I'd like something more like this (adapted from roughness):
float GDALSlopeHydroAlg (float* afWin, float fDstNoDataValue, void* pData)
{
// Hydrologic Slope is the max
// local slope btw center cell and adjacent cells
float pafLocalMax = afWin[0];
for ( int k = 1; k < 9; k++)
{
if (afWin[k] > pafLocalMax)
{
pafLocalMax=afWin[k];
}
}
return pafLocalMax - afWin[4];
}
Any critques? Reasons to not add?
Best,
Steve
Stephen Mather
GIS Manager
Cleveland Metroparks
4101 Fulton Pkwy
Cleveland, OH
44144
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111215/37cf78d2/attachment.html
More information about the gdal-dev
mailing list