-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Feature description
Earlier this week (during FOSS4GE 2024 2025), I wanted to take a DEM and calculate a U-V slope map from it.
I know I can do gdal raster slope
then gdal raster aspect
then gdal raster stack
then gdal raster calc
to convert the slope-aspect polar coordinate into a u-slope,v-slope cartesian coordinate (or x-y slope). But that is doing trigonometry back and forth and feels like extra computing.
So I'd like to propose gdal raster derivative
.
It should take a single band as input, and output two bands: the x-derivative and the y-derivative. The x-derivative band is, for each pixel, the difference between the pixels to the left and to the right; the y-derivative is the difference between the pixels up and below.
In other words: the x-derivative band is like applying this image kernel to the input band:
[ 0 0 0]
[-1 0 1]
[ 0 0 0]
...and the y-derivative band is like applying this kernel:
[0 -1 0]
[0 0 0]
[0 1 0]
Perhaps this tool could output a single band by having a parameter to discern between the X and Y directions. Otherwise I believe this would be a nice simple tool with its own use cases.
I've thought about specifying the angle for the derivative, or specifying custom kernels, but that sounds like overkill.
Additional context
This is just an idea, and I have no immediate need for it; please consider this feature request as low priority.
And greetings from the FOSS4G-EU codesprint!