-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] raster_statistic expression function for retrieving
raster band stats from a loaded layer Allows raster band stats (eg min, max, avg) to be used in expressions
- Loading branch information
1 parent
86ab302
commit 20dc7fb
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "raster_statistic", | ||
"type": "function", | ||
"description": "Returns statistics from a raster layer.", | ||
"arguments": [ | ||
{"arg":"layer", "description":"a string, representing either a raster layer name or layer ID"}, | ||
{"arg":"band", "description":"integer representing the band number from the raster layer, starting at 1"}, | ||
{"arg":"property", "description":"a string corresponding to the property to return. Valid options are:<br /><ul><li>min: minimum value</li><li>max: maximum value</li><li>avg: average (mean) value</li><li>stdev: standard deviation of values</li><li>range: range of values (max - min)</li><li>sum: sum of all values from raster</li></ul>"} | ||
], | ||
"examples": [ | ||
{ "expression":"raster_statistic('lc',1,'avg')", "returns":"Average value from band 1 from 'lc' raster layer"}, | ||
{ "expression":"raster_statistic('ac2010',3,'min')", "returns":"Minimum value from band 3 from 'ac2010' raster layer"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20dc7fb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really useful function, thanks. It'd be really cool for it to support an optional 4th parameter that would take a geometry (point, line, or polygon) to limit statistics to pixels overlapping the given geometry.