Wednesday, 31 August 2016

Simple band arithmetic on GDAL virtual rasters (VRT)



I want to calculate the difference of two bands. I have the individual bands stored somewhere, but I was thinking that maybe there's a way of producing a VRT file that is the result of this difference. I know that you can use pixel functions in GDAL, but this limits the use (C++, and only available when the function is linked in...).


It would be nice if simple "virtual" operations were available!



Answer



Not easily, yet...


There are a couple of ways around though. In C++ you can compile the pixel function then dynamically register it by using the GDAL plugin mechanism (there are some examples here). Or even more interesting to Python scribblers like myself, you can write pixel functions in Python!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...