Re: [gdal-dev] Re: Slope in gdaldem

2012-03-01 Thread Eli Adam
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/osge

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
> > 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

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Joaquim Luis
On 16-12-2011 03:31, Stephen Mather wrote: Hmm. I don't follow? The revision would be this: float GDALSlopeHydroAlg (float* afWin, float fDstNoDataValue, void* pData) { // Hydrologic Slope is the max // local slope btw center cell and adjacent cells const double radiansToDegrees

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
Hmm. I don't follow? The revision would be this: 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

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Joaquim Luis
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]; }

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
Here's what I've settled on. Let me know your thoughts. The algorithm now correctly calculates angle to lowest nearby point. If it's a local minima, it instead calculates angle to the nearest high point, which will be a negative number, so if the user wants to nullify these or use them in additi

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
I agree both have their place. Sometimes we get a more consistent or more interesting answer from our analyses than from our field measurements. As to the approach, I agree with your assessment, I was thinking backwards-- one caveat-- how best to handle local minima? Insert a null? I'm afraid I

Re: [gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Matt Perry
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,

[gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
Apologies for the flurry, one more change: 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 = (GDALS

[gdal-dev] Re: Slope in gdaldem

2011-12-15 Thread Stephen Mather
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* p