<?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 ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/791998#M1588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would appreciate some syntax assistance regarding how to build in code the map algebra syntax used by RasterCalc tool in ArcGIS Pro.&amp;nbsp; I have successfully implemented other Geoprocessing tools and was able to create the necessary args for required value array without much&amp;nbsp;heartburn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, doing this for the RasterCalc Geoprocessing through code has proven elusive.&amp;nbsp; I have looked at the native tool in ArcGIS Pro. The tool appears to call for building a map algebra expression using an input raster and whatever calculation you wish to perform.&amp;nbsp; When I interactively use the tool, the desired syntax it produces is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"sd_20170201" * 10000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="raster calc tool ArcGIS Pro" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/313760_RasterCalcTool.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to run the tool interactively in ArcGIS Pro successfully. I thought this would be simple enough to build in code.&amp;nbsp;Unfortunately, it has proven more involved. &amp;nbsp;I have build numerous&amp;nbsp;versions ( fully qualifying the path to the input raster, various quoting strategies etc ) with no luck.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Interestingly, when I returned to running the tool interactively through ArcGIS Pro to revisit this, when I first build the string through the tool interface,&amp;nbsp; I noticed the icon appeared adjacent to the Map Algebra expression label displays a red circle with a white X,&amp;nbsp; when I hover over the icon, it displays a same syntax error message I am encountering through code:&amp;nbsp; &lt;EM&gt;"ERROR 000989&amp;nbsp; Python Syntax Error: Parsing error SyntaxError: invalid syntax ( &amp;lt;string&amp;gt;, line 1)"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;However, when&amp;nbsp; I click out of the expression textbox, the error icon disappears and the tool now likes the expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After observing this, I thought that perhaps clicking out of the expression textbox might append a carriage return&lt;BR /&gt;to the string.&amp;nbsp; I tried the same approach in code, but it still threw the 989 error.&amp;nbsp; If anyone could provide the code version of building this seemingly simple string that the RasterCalc tool would like in code, I would be quite grateful.&lt;/P&gt;&lt;P&gt;Thanks for your time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Feb 2017 16:47:40 GMT</pubDate>
    <dc:creator>ThomasCox</dc:creator>
    <dc:date>2017-02-02T16:47:40Z</dc:date>
    <item>
      <title>ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/791998#M1588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would appreciate some syntax assistance regarding how to build in code the map algebra syntax used by RasterCalc tool in ArcGIS Pro.&amp;nbsp; I have successfully implemented other Geoprocessing tools and was able to create the necessary args for required value array without much&amp;nbsp;heartburn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, doing this for the RasterCalc Geoprocessing through code has proven elusive.&amp;nbsp; I have looked at the native tool in ArcGIS Pro. The tool appears to call for building a map algebra expression using an input raster and whatever calculation you wish to perform.&amp;nbsp; When I interactively use the tool, the desired syntax it produces is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"sd_20170201" * 10000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="raster calc tool ArcGIS Pro" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/313760_RasterCalcTool.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to run the tool interactively in ArcGIS Pro successfully. I thought this would be simple enough to build in code.&amp;nbsp;Unfortunately, it has proven more involved. &amp;nbsp;I have build numerous&amp;nbsp;versions ( fully qualifying the path to the input raster, various quoting strategies etc ) with no luck.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Interestingly, when I returned to running the tool interactively through ArcGIS Pro to revisit this, when I first build the string through the tool interface,&amp;nbsp; I noticed the icon appeared adjacent to the Map Algebra expression label displays a red circle with a white X,&amp;nbsp; when I hover over the icon, it displays a same syntax error message I am encountering through code:&amp;nbsp; &lt;EM&gt;"ERROR 000989&amp;nbsp; Python Syntax Error: Parsing error SyntaxError: invalid syntax ( &amp;lt;string&amp;gt;, line 1)"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;However, when&amp;nbsp; I click out of the expression textbox, the error icon disappears and the tool now likes the expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After observing this, I thought that perhaps clicking out of the expression textbox might append a carriage return&lt;BR /&gt;to the string.&amp;nbsp; I tried the same approach in code, but it still threw the 989 error.&amp;nbsp; If anyone could provide the code version of building this seemingly simple string that the RasterCalc tool would like in code, I would be quite grateful.&lt;/P&gt;&lt;P&gt;Thanks for your time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2017 16:47:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/791998#M1588</guid>
      <dc:creator>ThomasCox</dc:creator>
      <dc:date>2017-02-02T16:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/791999#M1589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want to use&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/raster-calculator.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Raster Calculator&lt;/A&gt; tool in your .NET code, is it correct? If yes I see no problems to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; expression &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\"tmp.png\\Band_1\" * 10"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; outputRaster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;@"D:\tmp\out_from_rc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; parameters &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;MakeValueArray&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputRaster&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;@"D:\tmp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; environments &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;MakeEnvironmentArray&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; gpResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ExecuteToolAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"RasterCalculator"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; environments&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CancelableProgressor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I succesfully created &lt;STRONG&gt;out_from_rc&lt;/STRONG&gt; raster dataset with this code. It seems that you've missed to set &lt;STRONG&gt;workspace&lt;/STRONG&gt; environment variable. It should be set to location where your rasters are placed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;P.S.&lt;/STRONG&gt; Very often validation in text boxes occurs only on text box lost keyboard focus. It is standard practice and there is really nothing unusual in this behavior. So if you type some invalid expression, click outside of the text box (now red circle with X will appear), then return to text box and correct your expression, red circle with X will not disappear until the text box lost keyboard focus. It is normal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:05:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/791999#M1589</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T09:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792000#M1590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;Hi Max,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;Thanks for your help.&amp;nbsp; I appreciate you taking to the time to respond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;Yes, I am trying to use the RasterCalc tool from dot net code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;I have tried using your syntax as well as using the workspace environment, and am still encountering the same problem.&amp;nbsp; I noticed your example referenced a png file.&amp;nbsp; I don’t know if using esri GRIDS requires a different approach.&amp;nbsp; However, I interactively ran the raster calculator tool in ArcGIS Pro and the syntax it built on the screen appeared to be the same for GRIDs as well as pngs.&amp;nbsp; I noticed your example referenced Band_1 in the expression piece.&amp;nbsp; The GRIDs I am using only contain one band.&amp;nbsp; However, as an experiment, I did try expressions referencing Band_1 with the same results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;If you don’t mind taking a look, perhaps you can see the error of my ways.&amp;nbsp; The ‘source’ &amp;nbsp;esri GRID directory is located on one of our network drives. For example the source grid would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;EM style="color: #1f497d; font-size: 11pt; font-family: 'Calibri',sans-serif;"&gt;@”&lt;A href="https://community.esri.com/"&gt;&lt;SPAN style="color: #3778c7; text-decoration: underline;"&gt;\\dom.example\data\snow\sd_20170201&lt;/SPAN&gt;&lt;/A&gt;”&lt;/EM&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;This path points to a GRID directory.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;With these parameters I have tried the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var expression = @”&lt;A href="https://community.esri.com/"&gt;&lt;SPAN style="color: #3778c7; text-decoration: underline;"&gt;\\dom.example\data\snow\sd_20170201&lt;/SPAN&gt;&lt;/A&gt;” + “ * “ + “10000”;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var outputRaster = @”C:\Temp\out_from_rc”;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var parameters = Geoprocessing.MakeValueArray(expression, outputRaster);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var workspace = @”C:\Temp”;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var environments = Geoprocessing.MakeEnvironmentArray(workspace: workspace);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gpResults = await Geoprocessing.ExecuteToolAsycn(“RasterCalculator”, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parameters,environments,CancelableProgressor.None);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;I have tried some variations of syntax for the expression, with no luck.&amp;nbsp; &amp;nbsp;I don’t know if using the GRID format introduces different requirements or having the source data and the results data living in different workspaces creates issues.&amp;nbsp; The interactive tool does not seem to mind any of this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="color: #1f497d; font-family: 'Calibri',sans-serif; font-size: 11pt;"&gt;Once again, thanks for responding.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 17:07:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792000#M1590</guid>
      <dc:creator>ThomasCox</dc:creator>
      <dc:date>2017-02-07T17:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792001#M1591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course I am seeing errors:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Your input raster is placed in &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;\\dom.example\data\snow&lt;/SPAN&gt;. So why do you try to use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;C:\Temp&lt;/SPAN&gt; as a value for the &lt;STRONG&gt;workspace&lt;/STRONG&gt; environment variable? This variable must be set to location where your rasters are placed as I wrote in my previous comment.&lt;/LI&gt;&lt;LI&gt;Expression must not contain full paths of input rasters. You specify path to them in &lt;STRONG&gt;workspace&lt;/STRONG&gt; environment variable. Expression should contain only names of input rasters (optionally with band name).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the right version of your code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; expression &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\"sd_20170201\" * 10000"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; outputRaster &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;@"C:\Temp\out_from_rc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; parameters &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;MakeValueArray&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputRaster&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;@"\\dom.example\data\snow"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; environments &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;MakeEnvironmentArray&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; gpResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; Geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ExecuteToolAsycn&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"RasterCalculator"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameters&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; environments&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CancelableProgressor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tested this code with input ESRI GRID raster stored in remote directory and succesfully created output raster with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:05:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792001#M1591</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T09:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792002#M1592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Max.&amp;nbsp; I did not understand the role of the workspace in the process.&amp;nbsp; I thought fully pathing to the source was necessary in the 'expression'. Now that you pointed out the error of my ways, it seems straight forward.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally, while I was working on this, with a tip from ESRI, I looked at the "Times" tool and was able to use it to achieve the desired result as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your time and thanks for the assistance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 14:37:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/792002#M1592</guid>
      <dc:creator>ThomasCox</dc:creator>
      <dc:date>2017-02-08T14:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro RasterCalc Tool Map Algebra Expression Proper Syntax through code</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/1092456#M7075</link>
      <description>&lt;P&gt;I struggled to get a simple raster calculator expression working with v2.8.2. I started with &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-pro-net/analytics/executing-spatial-analyst-tools-using-arcgis-pro-sdk-2/" target="_self"&gt;this example&lt;/A&gt; from the ArcGIS blog. The problem is that the example shows the layer file names encased by single quotes and it apparently needs to be double quotes. With double quotes, my expression with fully qualified file names works fine. Unfortunately comments are closed for the blog entry.&lt;/P&gt;&lt;P&gt;Some sample C#:&lt;BR /&gt;string annualRaster =&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;@”C:\Docs\animas_AOI_prms\prism.gdb\annual”;&lt;BR /&gt;string quarterlyRaster =&amp;nbsp;&amp;nbsp;@”C:\Docs\animas_AOI_prms\prism.gdb\sq1”;&lt;BR /&gt;&lt;/SPAN&gt;string maExpression = String.Format("\"{1}\" / \"{0}\" * 100", annualRaster, quarterlyRaster);&lt;BR /&gt;var valueArray = Geoprocessing.MakeValueArray(maExpression, outRaster);&lt;BR /&gt;var gpResult = await Geoprocessing.ExecuteToolAsync("RasterCalculator_sa", valueArray, environments);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 20:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-rastercalc-tool-map-algebra-expression/m-p/1092456#M7075</guid>
      <dc:creator>LesleyBross1</dc:creator>
      <dc:date>2021-08-25T20:12:13Z</dc:date>
    </item>
  </channel>
</rss>

