macro_rules! raster {
($expr:expr) => { ... };
({ $($stmt:stmt);+ }) => { ... };
}Expand description
Build a CompiledProgram from raster-algebra
DSL tokens written inline in Rust.
The tokens are stringify!d and then parsed and compiled at run time
(not at compile time). The macro expands to an expression of type
CompiledProgram, so it must be used in a context where the ? operator can
propagate a parse error (i.e. a function returning
Result).
§Examples
ⓘ
use oxigeo_algorithms::raster;
// Simple NDVI calculation
let ndvi = raster!((NIR - RED) / (NIR + RED));
// Complex multi-band analysis with conditions
let result = raster! {
let ndvi = (B8 - B4) / (B8 + B4);
if ndvi > 0.6 then 1 else 0
};