[gdal-dev] Re: Slope in gdaldem

Stephen Mather mather.stephen at gmail.com
Fri Dec 16 00:05:55 EST 2011


>
> Steve, there are more things I do not understand either. What is
> 'psData->scale'? Is it the grid cell size?
> So, if 'pafLocalMin' is on one of the 4 corners the distance is not cell
> size (let's call it DX) but instead sqrt(DX*DX + DX*DX).
> And what if data is in geogs? Than DX is clearly different from DY and
> changes with latitude. You need to take that into account to compute the
> slope.
>
>
:)  I don't plan to refactor this for non-planar coordinate systems.  That
is beyond my skills.  AFAIK, none of the gdaldem code would be appropriate
to run on lat lon-- which is probably something which would be good to
address, since many global datasets default to that, but I can barely read
c++, let along do that level of refactoring.  Of course, if I'm wrong in
how I'm reading the source for the existing gdaldem code, and it does deal
with non-planar cases, I'll adapt that code for this use case.

As to corners and sqrt(2), I'll take another look through tomorrow.  In the
likely case that you're right, I was sloppy in adapting the roughness index
for this purpose and will have to take those distances into account.  This
will of course change the metric by which the lowest nearby point is
determined, because of how distance will affect the factor of slope.

And so, my 10 minute solution takes much longer in the end... .

Best,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111216/ff0d2cbc/attachment.html


More information about the gdal-dev mailing list