Geographic Information Systems Asked on August 10, 2020
What is the correct syntax for the ‘Predefined expressions’ feature of the Raster Calculator of QGIS 3.14? How one can replace layer names with variables in the expression being saved (so they can be selected from dropdowns later, just like in predefined NDVI formula)? Is adding some other variables possible?
I mean the calculator which can be found in Processing Toolbox > Raster analisys > Raster calculator, not the one from the ‘Raster’ menu > Raster Calculator. (By the way, why there are two raster calculators?)
I've found out that one can simple put a json file called rastercalcexpressions.json
to the PROFILENAMEprocessing
folder, where 'PROFILENAME' is the QGIS profile folder (Settings > User profiles > Open active profile folder
).
This file should contain expressions to use in raster calculator with bands replaced with [bandname]
placeholders, something like this:
{"NDVI": "([NIR] - [Red]) / ([NIR] + [Red])", "NDSI": "([Green] - [SWIR1]) / ([Green] + [SWIR1])"}
Then the bands can be selected with dropdown menus later.
That's not the full answer, I still don't know how to save an expression (and name its input fields) directly from the calculator, but that one works too.
Answered by Nick L on August 10, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP