<?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: Raster Calculator Expression in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74724#M1027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Which version of ArcGIS?&lt;BR /&gt;&lt;BR /&gt;Just from a cursory look I'm wondering if your paths should be:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rasterCalc.expression = "D:\NewFolder\Raster1.tif" + " + " + "D:\NewFolder\Raster2.tif";
rasterCalc.output_raster = "D:\NewFolder\Raster3.tif";
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Your expression is simple enough you may want to use the Plus tool. That would likely avoid some complications from accessing this functionality from .NET.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi curtvprice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply. I am using Arc Engine 10. I do not have Desktop SDK to use the PLUS tool. I tried using the paths you have mentioned, but I got the same error again. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sindhu.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:53:54 GMT</pubDate>
    <dc:creator>SindhuA</dc:creator>
    <dc:date>2021-12-10T22:53:54Z</dc:date>
    <item>
      <title>Raster Calculator Expression</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74722#M1025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wanted to add the height information of two rasters and create another raster using the raster calculator. In Desktop Raster Calculator Tool the expression for the Same is like this - "Raster1" + "Raster2".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was trying to implement the same through coding in ArcGIS Engine using a Geoprocessing tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code snippet is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Geoprocessor gp = new Geoprocessor();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.OverwriteOutput = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RasterCalculator rasterCalc = new RasterCalculator();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rasterCalc.expression = " '@D:\NewFolder:\Raster1.tif" + "+" + "@D:\NewFolder:\Raster2.tif' ";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rasterCalc.output_raster = "@D:\NewFolder:\Raster3.tif";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Execute(rasterCalc,null);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not getting executed and throws an error: HRESULT E_FAIL has been returned from a call to a COM component.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think there is something wrong with the syntax of the expression. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in Advance for the help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sindhu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 03:28:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74722#M1025</guid>
      <dc:creator>SindhuA</dc:creator>
      <dc:date>2013-12-30T03:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Expression</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74723#M1026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi,&lt;BR /&gt;I wanted to add the height information of two rasters and create another raster using the raster calculator. In Desktop Raster Calculator Tool the expression for the Same is like this - "Raster1" + "Raster2".&lt;BR /&gt;I was trying to implement the same through coding in ArcGIS Engine using a Geoprocessing tool.&lt;BR /&gt;&lt;BR /&gt;The code snippet is as follows:&lt;BR /&gt; &lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
RasterCalculator rasterCalc = new RasterCalculator();
rasterCalc.expression = " '@D:\NewFolder:\Raster1.tif" + "+" + "@D:\NewFolder:\Raster2.tif' ";
rasterCalc.output_raster = "@D:\NewFolder:\Raster3.tif";
gp.Execute(rasterCalc,null);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This is not getting executed and throws an error: HRESULT E_FAIL has been returned from a call to a COM component.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Which version of ArcGIS?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just from a cursory look I'm wondering if your paths should be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rasterCalc.expression = "D:\NewFolder\Raster1.tif" + " + " + "D:\NewFolder\Raster2.tif";
rasterCalc.output_raster = "D:\NewFolder\Raster3.tif";
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your expression is simple enough you may want to use the Plus tool. That would likely avoid some complications from accessing this functionality from .NET.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:53:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74723#M1026</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-10T22:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Expression</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74724#M1027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Which version of ArcGIS?&lt;BR /&gt;&lt;BR /&gt;Just from a cursory look I'm wondering if your paths should be:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rasterCalc.expression = "D:\NewFolder\Raster1.tif" + " + " + "D:\NewFolder\Raster2.tif";
rasterCalc.output_raster = "D:\NewFolder\Raster3.tif";
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Your expression is simple enough you may want to use the Plus tool. That would likely avoid some complications from accessing this functionality from .NET.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi curtvprice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply. I am using Arc Engine 10. I do not have Desktop SDK to use the PLUS tool. I tried using the paths you have mentioned, but I got the same error again. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sindhu.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:53:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74724#M1027</guid>
      <dc:creator>SindhuA</dc:creator>
      <dc:date>2021-12-10T22:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Raster Calculator Expression</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74725#M1028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&amp;nbsp; I tried using the paths you have mentioned, but I got the same error again.&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried this example from the .NET help? It sure looks like an safer approach than using raw pathnames.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/Executing_a_map_algebra_expression/000100000165000000/"&gt;ArcObjects .NET Help: Executing a map algebra expression&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2014 14:47:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/raster-calculator-expression/m-p/74725#M1028</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-01-08T14:47:48Z</dc:date>
    </item>
  </channel>
</rss>

