The following procedures can be used to generate a raster calculator script and run the raster calculator script from a CSTalk script. To create a new raster grid, refer to the Grid Layers section of the help.
ClearRasterCalculator ()
The ClearRasterCalculator procedure will clear any raster calculator code that is currently displayed in the raster calculator or any code that remains from a previous raster calculator application. This procedure should be called prior to running any new raster calculator scripts. It does not require any input parameters.
AddToRasterCalculator ( String , Add New Line )
The AddToRasterCalculator will add a user specified string to the pixel code section of the Raster Calculator. The procedure also provides the option to add the string to the existing in the raster calculator or add it to a new line. Pease note that this procedure only adds text to the pixel code section of the Raster Calculator. Code that would have otherwise be used in the setup code section of the Raster Calculator can be called directly from the CSTalk script (eg., CreateNewGrid, AssignVariable)
Parameter |
Description |
Accepted Values / Data Type |
String |
Text to be added to pixel code section of Raster Calculator |
String |
Add New Line |
Boolean value to determine if String will be added on a new line of code. If TRUE string will be placed on a new line in the pixel code section of the Raster Calculator. If FALSE string will be retained on current line |
TRUE or FALSE |
EXAMPLE
{The following code will add "WriteValue(#&Var#,56)" to the raster calculator}
AddToRasterCalculator("WriteValue(",True)
AddToRasterCalculator("#",False)
AddToRasterCalculator(&Var,False)
AddToRasterCalculator("#,56)",False)
LoadRCScript ( FilePath )
The LoadRCScript will load an existing raster calculator script into the Raster Calculator. The full path and file name of the script must be provided. This procedure will not run the raster calculator script. In order to achieve this, the LoadRCScript procedure must be called followed by the RunRasterCalculator procedure. Please note that any code that was previously added to the Raster Calculator (e.g., using the AddToRasterCalculator procedure) will be removed when this procedure is called.
Parameter |
Description |
Accepted Values / Data Type |
Filepath |
The file path to the raster calculator code (*.rcc) script |
String |
EXAMPLE
LoadRCScript(c:\PRM.rcc)
RunRasterCalculator ()
The RunRasterCalculator procedure will start the raster calculator with any code that has been added to the calculator or any code that remains in the Raster Calculator from previous raster calculations. The procedure does not require any input parameters.