Raster algebra in QGIS.
RasterCalc is a simple and powerfull raster calculator that is a plugin for free and opensource GIS — QGIS.
Plugin is available in official repository.
The plugin is designed for QGIS version 1.3.0 and higher. You will need the following additional Python modules installed:
If this modules are not installed in your system, you'll see error message on plugin startup, asking for one this modules.
All necessary packages are available in OSGeo4W installer. You can find them in Libs category (pyparsing and gdal-python packages). If you use standalone installer you need to download and install pyparsing.
You can obtain sources from our SVN:
svn co http://svn.gis-lab.info/rastercalc ractercalc
After you've installed the plugin and started it by clicking toolbar button in the main window
calculator will appear
Expression format is traditional, same as in mathematics: there is support of parentheses and included parentheses. Raster names must be in square brackets (""), followed by symbol "@" and number which denotes band number. It is possible to insert raster name automaticaly by doublecliking on it's name in raster list, raster with first band will be inserted. Inserting raster name with different band number is possible by doubleclicking on the band number in bands list.
Some common expressions are saved as presets. When preset is selected in dropdown list it will be inserted in expression area and sample raster names must be replaced with real raster names.
Plugin does some checking during expression composing. If errors is found a message will appear on the message bar and calculate button will be disabled.
Using quick access buttons you can insert:
Also implemented, but not available with quick access buttons (you need to enter it manually):
Comparison operators allow to perform pixel-wise compare raster band with some value or another raster band. The result will be a raster with all pixels that match condition set to 1 and all other pixels set to 0.
Conditional statements are further development of comparison operators. Statement has three arguments:
A value or any raster band can be used as second and third argument (in this case pixel-wise compare and/replace is used) or expression.
Consider the use of conditional statements with examples. Statement:
le( [relief]@1, 50, 200 )
should be read as: all pixels in first band of the relief raster with value less or equal then 50, should be replaced with value 200.
eq( [relief]@1, [mask]@4, 150 )
all pixels in first band of the relief raster with value equal to the appropriate pixels in fourth band of the mask raster, should be replaced with value 150.
gt( [relief]@1, [mask]@4, [base]@2 )
all pixels in first band of the relief raster, with value greater or equal to the appropriate pixels in fourth band of the mask raster, should be replaced with the appropriate pixels from second band of the base raster.
If you want report a bug or want make suggestion — use bugtracker.
Последнее обновление: 2014-05-14 22:26
Дата создания: 27.01.2010
Автор(ы): Александр Бруй