2

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!

1 Answer 1

1

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!

2
  • OK, I wasn't aware that you could write python pixel functions. I guess that's as good as it gets :)
    – Jose
    Dec 7, 2011 at 14:48
  • While theoretically you can write VRT pixel functions in Python, I imagine that would be rather inefficient. I'd think you'd be better served letting more optimized code do the heavy lifting, i.e. use a GIS (qgis, ESRI, etc.) or numpy if you're writing scripts.
    – user2856
    Dec 8, 2011 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.