<?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: Using python cursors in gpk in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230180#M2736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can you share your Python script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 May 2016 19:56:25 GMT</pubDate>
    <dc:creator>MichaelBranscomb</dc:creator>
    <dc:date>2016-05-10T19:56:25Z</dc:date>
    <item>
      <title>Using python cursors in gpk</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230179#M2735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="text-align: left;"&gt;Hello&lt;/P&gt;&lt;P style="text-align: left;"&gt;I created a tool based on python script and pack it into gpk.&lt;/P&gt;&lt;P style="text-align: left;"&gt;When I try to run it from RT SDK for .net as local service it does not work.&lt;/P&gt;&lt;P style="text-align: left;"&gt;After the line "p = row[0]" I get the error that p is not defined.&lt;/P&gt;&lt;P style="text-align: left;"&gt;I am trying to read the coordinate of a layer that was created in the tool.&lt;/P&gt;&lt;P style="text-align: left;"&gt;I tried both "old" cursors and the da cursor.&lt;/P&gt;&lt;P style="text-align: left;"&gt;Is this a known limitation? How can I get the value of some records in the results (I would like to return it as a string).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 05:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230179#M2735</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2016-05-10T05:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using python cursors in gpk</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230180#M2736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can you share your Python script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 19:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230180#M2736</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2016-05-10T19:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using python cursors in gpk</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230181#M2737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="text-align: left;"&gt;Hi Mike&lt;/P&gt;&lt;P style="text-align: left;"&gt;Thanks for the response; I was hoping to get your attention &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;My code do basic Viewshed operation but later on I will add more functionality to intersect with some polyline/polygon and determine the overlap area.&lt;/P&gt;&lt;P style="text-align: left;"&gt;In my code I need to get the point coordinate to set the extent (works much quicker).&lt;/P&gt;&lt;P style="text-align: left;"&gt;You can see the code that does not work in comment and the work around I found.&lt;/P&gt;&lt;P style="text-align: left;"&gt;Even with this workaround it still does not work. It gives me error message about Desktop 10.2 that was installed once on my machine but now I have 10.3.1&lt;/P&gt;&lt;P style="text-align: left;"&gt;I wonder if the cursor should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;Thanks&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
obs = arcpy.GetParameterAsText(0)
rad = arcpy.GetParameter(1)
# constants
arcpy.env.overwriteOutput = True
dtm = r"C:\demos\RtGp\dem_itm.tif"
# temporary names
outRaster = arcpy.env.scratchFolder + r"\visRas.tif"
outVector = r"in_memory\visVec"
# set extent of operation
#with arcpy.da.SearchCursor(obs, "&lt;A href="mailto:SHAPE@XY" rel="nofollow noopener noreferrer" target="_blank"&gt;SHAPE@XY&lt;/A&gt;") as cursor:
#&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = row[0]
desc = arcpy.Describe(obs)
arcpy.env.extent = "%s %s %s %s" % (desc.extent.XMin - rad,desc.extent.YMin - rad,desc.extent.XMin + rad,desc.extent.YMin + rad)
#arcpy.env.extent = "%s %s %s %s" % (p[0] - rad,p[1] - rad,p[0] + rad,p[1] + rad)
# prepare observer
arcpy.AddField_management(obs,"OFFSETA","LONG")
arcpy.AddField_management(obs,"RADIUS2","LONG")
arcpy.CalculateField_management(obs,"OFFSETA",7, "PYTHON_9.3")
arcpy.CalculateField_management(obs,"RADIUS2",3000 , "PYTHON_9.3")
# start process - visibility
arcpy.Viewshed_3d(dtm,obs,outRaster)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:12:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230181#M2737</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2021-12-11T11:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using python cursors in gpk</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230182#M2738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solved it&lt;/P&gt;&lt;P&gt;The python script did not get the input point for the observer so the layer was empty and the cursor retun nothing but did not fail.&lt;/P&gt;&lt;P&gt;When I translate everything to web mercator it all works.&lt;/P&gt;&lt;P&gt;I think you should write a paper about using local projection, this is needed in many local application that does not use AGOL.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 07:15:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/using-python-cursors-in-gpk/m-p/230182#M2738</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2016-05-11T07:15:55Z</dc:date>
    </item>
  </channel>
</rss>

