Apologies for the flurry, one more change:<br><br>float GDALSlopeHydroAlg (float* afWin, float fDstNoDataValue, void* pData)<br>{<br> // Hydrologic Slope is the max<br> // local slope btw center cell and adjacent cells<br>
<br> const double radiansToDegrees = 180.0 / M_PI;<br> GDALSlopeAlgData* psData = (GDALSlopeAlgData*)pData; <br> double key;<br> <br> float pafLocalMax = afWin[0];<br><br> for ( int k = 1; k < 9; k++)<br>
{<br> if (afWin[k] > pafLocalMax)<br> {<br> pafLocalMax=afWin[k];<br> }<br> }<br> <br> key = pafLocalMax - afWin[4];<br> <br> if (psData->slopeFormat == 1) <br> return (float) (atan(sqrt(key) / (2*psData->scale)) * radiansToDegrees);<br>
else<br> return (float) (100*(sqrt(key) / (2*psData->scale)));<br>}<br><br>Best,<br>Steve<br>