[gdal-dev] Re: Slope in gdaldem

Eli Adam eadam at co.lincoln.or.us
Thu Mar 1 11:41:50 EST 2012


Steve,

> additional processing steps they can.  How does adding code to gdal work?

Just from an observer perspective, it seems that once you have your
additions worked out, attach a diff on on trac ticket.  The details
for how to do that are: sign up for an osgeo userid,
http://www.osgeo.org/osgeo_userid (if you don't already have one),
login to the gdal trac and then open a new ticket,
http://trac.osgeo.org/gdal/report

I don't know the likelihood of one of the developers adding it in,
someone might comment on the ticket about that (could depend on the
code, impacts to other parts, etc).  Putting it in a ticket also makes
it available to anyone that may want to  locally apply it for
themselves.

HTH, Eli


> Best,
> Steve
>
>
> 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;
>                 double key;
>
>     float pafLocalMin = afWin[0];
>
>      float pafLocalMax = afWin[0];
>
>     for ( int k = 1; k < 9; k++)
>     {
>         if (afWin[k] < pafLocalMin)
>         {
>             pafLocalMin=afWin[k];
>
>         }
>
>         if (afWin[k] > pafLocalMax)
>         {
>             pafLocalMax=afWin[k];
>         }
>
>     }
>
>     key = afWin[4] - pafLocalMin;
>
>     if (key < 0)
>      {
>         key = afWin[4] - pafLocalMax;
>
>      }
>
>     if (psData->slopeFormat == 1)
>         return (float) (atan(sqrt(key) / (2*psData->scale)) *
> radiansToDegrees);
>     else
>         return (float) (100*(sqrt(key) / (2*psData->scale)));
> }
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list