<?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 ArcPy Select / ZoomTo/ the attribute records and write to text the Map Scale in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-select-zoomto-the-attribute-records-and/m-p/539162#M42143</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Group,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to use ArcPy to extract the individual mxd map scale (the data frame scale of the map after selecting a record and using the "ZoomTo" function)&amp;nbsp; of each record in a feature class, and writing it to a text file.&amp;nbsp; I have some python code that works through a For: Loop, but it only returns the first record zoomed in map df.scale, instead of iterating through the entire attribute table.&amp;nbsp; I realize I need to identify the individual rows within the loop, but I'm failing to grasp how to do that.&amp;nbsp; So I'm looking for any help on how to correctly code this process.&amp;nbsp; Here is what I'm working with minus the end process of writing the results to a text file. (I'm a newbie to python as well, but I'm trying&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; )&amp;nbsp; ps. the "print" line is there to see the results before writing them to text.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; env.workspace = "D:/Data/Workspace"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("Current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; rows = arcpy.SearchCursor("ArcPyLoop")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.SelectLayerByAttribute_management("ArcPyLoop", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;Result 'ArcPyLoop'&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; for record in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df.zoomToSelectedFeatures()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print df.scale&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;115470.404513 (1st df.scale repeated for all rows in attribute table)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for any help or guidance&amp;nbsp;&amp;nbsp;&amp;nbsp; - Drob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Aug 2013 14:20:58 GMT</pubDate>
    <dc:creator>DerekRobinson</dc:creator>
    <dc:date>2013-08-14T14:20:58Z</dc:date>
    <item>
      <title>ArcPy Select / ZoomTo/ the attribute records and write to text the Map Scale</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-select-zoomto-the-attribute-records-and/m-p/539162#M42143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Group,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to use ArcPy to extract the individual mxd map scale (the data frame scale of the map after selecting a record and using the "ZoomTo" function)&amp;nbsp; of each record in a feature class, and writing it to a text file.&amp;nbsp; I have some python code that works through a For: Loop, but it only returns the first record zoomed in map df.scale, instead of iterating through the entire attribute table.&amp;nbsp; I realize I need to identify the individual rows within the loop, but I'm failing to grasp how to do that.&amp;nbsp; So I'm looking for any help on how to correctly code this process.&amp;nbsp; Here is what I'm working with minus the end process of writing the results to a text file. (I'm a newbie to python as well, but I'm trying&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; )&amp;nbsp; ps. the "print" line is there to see the results before writing them to text.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; env.workspace = "D:/Data/Workspace"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("Current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; rows = arcpy.SearchCursor("ArcPyLoop")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.SelectLayerByAttribute_management("ArcPyLoop", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;Result 'ArcPyLoop'&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; for record in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df.zoomToSelectedFeatures()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print df.scale&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = rows.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;115470.404513 (1st df.scale repeated for all rows in attribute table)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for any help or guidance&amp;nbsp;&amp;nbsp;&amp;nbsp; - Drob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 14:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-select-zoomto-the-attribute-records-and/m-p/539162#M42143</guid>
      <dc:creator>DerekRobinson</dc:creator>
      <dc:date>2013-08-14T14:20:58Z</dc:date>
    </item>
  </channel>
</rss>

