<?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: Custom Single Output Map Algebra Script in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39780#M1411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah. That was what I was missing. I thought it was refering to the parameters list above, and could not figure out what was different above it.&amp;nbsp; Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Aug 2010 13:12:54 GMT</pubDate>
    <dc:creator>DanielLusher</dc:creator>
    <dc:date>2010-08-11T13:12:54Z</dc:date>
    <item>
      <title>Custom Single Output Map Algebra Script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39778#M1409</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;BR /&gt;&lt;SPAN&gt;I'm trying to create a custom Single Output Map Algebra script so that I can have my user input values to run a model in Model Builder.&amp;nbsp; As of now, I cannot find a way to connect SOMA to a variable in Model Builder, and saw no answer on a thread on that subject.&amp;nbsp; Therefore I turned to python, but I am fairly new with python, so I was hoping someone could spot the error I've made in creating this script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import sys, string, os, arcgisscripting

gp = arcgisscripting.create(9.3)
gp.overwriteoutput = 1

msgNotEnoughParams = 'Incorrect number of input parameters.'

if len(sys.argv) &amp;lt; 1: raise Exception, msgNotEnoughParams
DEMraster = gp.GetParameterasText(0)
inputValue1 = gp.GetParameterasText(1)
inputValue2 = gp.GetParameterasText(2)
inputValue3 = gp.GetParameterasText(3)
outputRaster = gp.GetParameterasText(4)
xmap = gp.GetParameterasText(5)
ymap = gp.GetParameterasText(6)

gp.SingleOutputMapAlgebra_sa("ATan((" + inputValue3 + " - " + DEMraster + ") // ( sqrt(sqr(" + inputValue1 + " - " + xmap + ") + sqr(" + inputValue2 + " - " + ymap + "))))")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm currently getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000859: The required parameter Output raster is empty, or is not the type of Raster Dataset.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (SingleOutputMapAlgebra).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CustomMapAlgebra).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help on why this is happening would be much appreciated!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Aug 2010 17:59:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39778#M1409</guid>
      <dc:creator>DanielLusher</dc:creator>
      <dc:date>2010-08-09T17:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Single Output Map Algebra Script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39779#M1410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; ERROR 000859: The required parameter Output raster is empty, or is not the type of Raster Dataset.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;The error message is pretty self-explanatory. You don't specify an output raster parameter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The syntax is: &lt;/SPAN&gt;&lt;SPAN style="font-family:&amp;quot;Courier New&amp;quot;;"&gt;gp.SingleOutputMapAlgebra_sa(InExpression, OutRaster)&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;See &lt;A href="&amp;lt;/span&amp;gt;&amp;lt;a" target="_blank"&gt;Single" rel="nofollow" target="_blank"&amp;gt;http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Single%20Output%20Map%20Algebra]Single&lt;/A&gt;&lt;SPAN&gt; Output Map Algebra help.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Aug 2010 00:53:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39779#M1410</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2010-08-11T00:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Single Output Map Algebra Script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39780#M1411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah. That was what I was missing. I thought it was refering to the parameters list above, and could not figure out what was different above it.&amp;nbsp; Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Aug 2010 13:12:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39780#M1411</guid>
      <dc:creator>DanielLusher</dc:creator>
      <dc:date>2010-08-11T13:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Single Output Map Algebra Script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39781#M1412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to create a custom Single Output Map Algebra script so that I can have my user input values to run using python. My python code is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# rad226_67.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Created on: Thu Nov 24 2011 11:13:19 AM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcgisscripting, glob&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create the Geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Load required toolboxes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;imdir = 'E:\\223_67'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;os.chdir(imdir)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;path = '*.tif'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lista_in&amp;nbsp; = glob.glob(path)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lista_out = ["E:\\223_67\\rad_223_67_B1.tif", "E:\\223_67\\rad_223_67_B2.tif", "E:\\223_67\\rad_223_67_B3.tif",]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#v226_67_rad_tif = "E:\\223_67_rad.tif"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nimg = [0,1,3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for i in nimg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print i&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; img_in = lista_in&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print img_in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; img_out = lista_out&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print img_out&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Single Output Map Algebra...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.SingleOutputMapAlgebra_sa("- 1.52 + "+ img_in + " * ( 169 + 1.52 ) / 255", img_out, "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I ran for one image no errors, but for more I´m currently getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LANDSAT_5_TM_20100617_223_067_L2_BAND1.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;E:\223_67\rad_223_67_B1.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LANDSAT_5_TM_20100617_223_067_L2_BAND2.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;E:\223_67\rad_223_67_B2.tif&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Work2011\INPE\landsat\rad226_67.py", line 37, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.SingleOutputMapAlgebra_sa("- 1.52 + "+ img_in + " * ( 169 + 1.52 ) / 255", img_out, "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000865: Map Algebra expression: LANDSAT_5_TM_20100617_223_067_L2_BAND2.tif does not exist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (SingleOutputMapAlgebra).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help on why this is happening would be much appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2011 12:07:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/custom-single-output-map-algebra-script/m-p/39781#M1412</guid>
      <dc:creator>MarcioMoraes</dc:creator>
      <dc:date>2011-11-29T12:07:28Z</dc:date>
    </item>
  </channel>
</rss>

