[gdal-dev] Re: Slope in gdaldem

Matt Perry perrygeo at gmail.com
Thu Dec 15 13:45:59 EST 2011


Stephen,


It'd be great to see local hydrologic slope in gdaldem.

I've seen a similar discrepancy between "field" slope and most
GIS-derived slopes. The local max hydrologic slope seems to correspond
much better to our perceived slope on the ground. The integrated slope
used in most GIS, however, better matches the overall planar slope
over a large extent. So they both have their place depending on scale;
local hydrologic max slope for the micro, integrated planar slope for
the macro.

However, I don't think the algorithm that you describe below will
work. It's currently looking for the *maximum* local elevation and
computing slope to the center cell. Instead it should calculate the
slope in the direction of hydrologic flow; i.e. the slope from the
center cell to surrounding cell with the *minimum* elevation.


- matt

On Thu, Dec 15, 2011 at 10:29 AM, Stephen Mather
<mather.stephen at gmail.com> wrote:
> I already see a flaw-- the function should be more like:
>
>
> float GDALSlopeHydroAlg (float* afWin, float fDstNoDataValue, void* pData)
> {
>     // Hydrologic Slope is the max
>     //  local slope btw center cell and adjacent cells
>
>     const double radiansToDegrees = 180.0 / M_PI;
>     GDALSlopeAlgData* psData = (GDALSlopeAlgData*)pData;
>
>     float pafLocalMax = afWin[0];
>
>     for ( int k = 1; k < 9; k++)
>     {
>         if (afWin[k] > pafLocalMax)
>         {
>             pafLocalMax=afWin[k];
>         }
>     }
>     return atan(sqrt(pafLocalMax - afWin[4]) / (2*psData->scale)) *
> radiansToDegrees;
>
> }
>
>
>
> On Thu, Dec 15, 2011 at 11:49 AM, Stephen Mather <mather.stephen at gmail.com>
> wrote:
>>
>> 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
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
"The best way to predict the future is to invent it."  -- Alan Kay
Matthew T. Perry
http://www.perrygeo.net
http://viedevelo.wordpress.com


More information about the gdal-dev mailing list