<?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: Get Cell Value in Python in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348151#M12101</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My pleasure!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cedric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jun 2010 19:29:02 GMT</pubDate>
    <dc:creator>CedricWannaz</dc:creator>
    <dc:date>2010-06-22T19:29:02Z</dc:date>
    <item>
      <title>Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348148#M12098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need a DEM elevation using a pair of coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tested with gp.GetCellValue () but as output does not give me the elevation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a piece of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
........
quota = gp.GetCellValue(dem, "284889 4420904", "1")
print gp.AddMessage("La quota è&amp;nbsp; "&amp;nbsp; + str(quota))
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;and as message output get me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Start Time: Tue Jun 22 20:53:51 2010
Running script 1...
La quota è &amp;lt;geoprocessing server result object object at 0x17FCA7E8&amp;gt;
Completed script 1...
Executed (1) successfully.
End Time: Tue Jun 22 20:53:58 2010 (Elapsed Time: 7,00 seconds)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone give me some advice?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 17:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348148#M12098</guid>
      <dc:creator>SalvatoreLarosa</dc:creator>
      <dc:date>2010-06-22T17:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348149#M12099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What happens if you change your code for:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
........
gpResult = gp.GetCellValue(dem, "284889 4420904", "1")
print gp.AddMessage("La quota è&amp;nbsp; "&amp;nbsp; + str( gpResult.GetOutput(0) ))
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=921&amp;amp;pid=914&amp;amp;topicname=Getting_results_from_a_geoprocessing_tool" rel="nofollow noopener noreferrer" target="_blank"&gt;http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=921&amp;amp;pid=914&amp;amp;topicname=Getting_results_from_a_geoprocessing_tool&lt;/A&gt;&lt;SPAN&gt; for more information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cedric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:23:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348149#M12099</guid>
      <dc:creator>CedricWannaz</dc:creator>
      <dc:date>2021-12-11T16:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348150#M12100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, now work!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, but I could not find the link you gave me!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Salvatore&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 19:23:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348150#M12100</guid>
      <dc:creator>SalvatoreLarosa</dc:creator>
      <dc:date>2010-06-22T19:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348151#M12101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My pleasure!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cedric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 19:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348151#M12101</guid>
      <dc:creator>CedricWannaz</dc:creator>
      <dc:date>2010-06-22T19:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348152#M12102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to take advantage of your kindness .....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I make arithmetic operations such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dh = float(quota) - float(quotaNear)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;type 'exceptions.ValueError'&amp;gt;: invalid literal for float(): 1598,7365
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I change the string in&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dh = quota - quotaNear&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;type 'exceptions.TypeError'&amp;gt;: unsupported operand type(s) for -: 'unicode' and 'unicode'
Failed to execute (Script).
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Salvatore&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:23:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348152#M12102</guid>
      <dc:creator>SalvatoreLarosa</dc:creator>
      <dc:date>2021-12-11T16:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348153#M12103</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; The quota variables that you are using are strings, so you can't subtract them (which explains the second error). The first error comes from the fact that your decimal separator is a comma, and the typecast to float wants a period instead. There are a lot of ways to change this .. a simple one would be basic string replacement. Being strings or string objects, your quota variables have methods, and in particular one for sub-string replacement: replace(). You can use it simply as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;quota_period = quota.replace(',', '.') &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which would give, applied to your case and without creating intermediary variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dh = float( quota.replace(',', '.') ) - float( quotaNear.replace(',', '.') )
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cedric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:22:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348153#M12103</guid>
      <dc:creator>CedricWannaz</dc:creator>
      <dc:date>2021-12-12T16:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348154#M12104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;THANKS!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IT'S WORK!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 17:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348154#M12104</guid>
      <dc:creator>SalvatoreLarosa</dc:creator>
      <dc:date>2010-06-23T17:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get Cell Value in Python</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348155#M12105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're welcome!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cedric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 18:28:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/get-cell-value-in-python/m-p/348155#M12105</guid>
      <dc:creator>CedricWannaz</dc:creator>
      <dc:date>2010-06-23T18:28:47Z</dc:date>
    </item>
  </channel>
</rss>

