Due to poor python skills i don't have the possibility to write scripts to automate my raster operations. As a solution to my problems I thought the batch mode of raster calculator would do the trick. I use Microsoft Excel to generate commands and pathways for the output files, resulting in long lists. But much to my dismay I can't find any way to enter them all at the same time in the batch window. I have been forced to copy every single line by it self, and paste in to each corresponding batch row.I guess there must be a way to paste them in a more efficient way, but I can't find out how. If somebody could suggest me a solution I would be forever grateful!
from arcpy.sa import *
I have used concatenate function in excel to prepare the list of the calculator expressions [not sure if it is in the true format] and their output directories and file names as below."J:\sp1\sp1_Thresholded_0_3.img" + "J:\sp1\sp1_A2a_2020_Thresholded.img" ==> "J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img"
"J:\sp1\sp1_Thresholded_0_3.img" + "J:\sp1\sp1_A2a_2020_Thresholded.img" ==> "J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img"
from arcpy.sa import * rst = r"J:\sp1\sp1_Thresholded_0_3.img" + r"J:\sp1\sp1_A2a_2020_Thresholded.img";rst.save(r"J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img")
That's terrific! Thank you alot! Do you know how to specify output location/filename in this way? Right now it exports to a standard folder with some generic name.
In Arc 10.x, you should be able to paste your raster calculator expressions into the python command window, as long as you enter this line first:from arcpy.sa import *
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.