<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy several lines to the batch window of raster calculator in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522131#M7542</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"J:\sp1\sp1_Thresholded_0_3.img" + "J:\sp1\sp1_A2a_2020_Thresholded.img" ==&amp;gt; "J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img"&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As described in the help for the Raster Calculator tool, these are python expressions, so you need to be careful to escape your strings. The correct format for your expression in the Python window would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Using the ";" to join multiple lines in python is generally frowned upon [it kind of takes away Python's elegance can introduce bugs] but in your case of creating command lines to paste in the python window it is a workable trick.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note the use of "r" for raw strings. This prevents recognized escape expressions from being used, for example, "\t" is recognized by Python as a tab character (without the prefix "r").&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still think [post=191665]using the ModelBuilder Iterate Rasters,[/post] with the Calculate Value tool used to set up your pathnames, is far preferable to generating arcpy code in Excel.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:46:33 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2021-12-11T22:46:33Z</dc:date>
    <item>
      <title>Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522126#M7537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 10:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522126#M7537</guid>
      <dc:creator>RasmusErlandsson</dc:creator>
      <dc:date>2012-03-26T10:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522127#M7538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;BR /&gt;&lt;BR /&gt;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!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from arcpy.sa import *&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522127#M7538</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-03-26T13:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522128#M7539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from arcpy.sa import *
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:46:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522128#M7539</guid>
      <dc:creator>RasmusErlandsson</dc:creator>
      <dc:date>2021-12-11T22:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522129#M7540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please take a look at the following help document:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00p600000003000000.htm"&gt;A quick tour of using Map Algebra&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 13:59:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522129#M7540</guid>
      <dc:creator>TarunJaiswal</dc:creator>
      <dc:date>2012-03-27T13:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522130#M7541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello rasmerla, curtvprice &amp;amp; Tarun_Jaiswal&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I almost have the same problem and I have posted it &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/55472-Batch-raster-calculator?p=191453#post191453"&gt;here&lt;/A&gt;&lt;SPAN&gt;. 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"J:\sp1\sp1_Thresholded_0_3.img" + "J:\sp1\sp1_A2a_2020_Thresholded.img" ==&amp;gt; "J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to use ModelBuilder with raster calculator in the same way I use with other tools but it was unsuccessful. I also tried to used iterators but it was not successful with me as well (all operations were overwritten on just one file). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not have any background in Python but it does not seem too hard for me to do that task. Could you please help me with coding just one example mentioned above (using Python):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ahmed&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Apr 2012 07:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522130#M7541</guid>
      <dc:creator>AhmedEl-Gabbas</dc:creator>
      <dc:date>2012-04-21T07:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copy several lines to the batch window of raster calculator</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522131#M7542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"J:\sp1\sp1_Thresholded_0_3.img" + "J:\sp1\sp1_A2a_2020_Thresholded.img" ==&amp;gt; "J:\sp1\sp1_CCCMA_A2a_2020_GainLoss.img"&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As described in the help for the Raster Calculator tool, these are python expressions, so you need to be careful to escape your strings. The correct format for your expression in the Python window would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Using the ";" to join multiple lines in python is generally frowned upon [it kind of takes away Python's elegance can introduce bugs] but in your case of creating command lines to paste in the python window it is a workable trick.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note the use of "r" for raw strings. This prevents recognized escape expressions from being used, for example, "\t" is recognized by Python as a tab character (without the prefix "r").&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still think [post=191665]using the ModelBuilder Iterate Rasters,[/post] with the Calculate Value tool used to set up your pathnames, is far preferable to generating arcpy code in Excel.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:46:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/copy-several-lines-to-the-batch-window-of-raster/m-p/522131#M7542</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T22:46:33Z</dc:date>
    </item>
  </channel>
</rss>

