<?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 Set camera scale for map frame with Pythong in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495949#M84833</link>
    <description>&lt;P&gt;I am zooming to all features of a feature class and then setting the map scale to 5000.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;aprx= arcpy.mp.ArcGISProject(aprx)
l = aprx.listLayouts("Layout")[0]
mf = l.listElements('MAPFRAME_ELEMENT','Map Frame')[0]
#make feature layer or points
f2 = fc
#make feature layer
fl = arcpy.management.MakeFeatureLayer(f2,f2)
#loop through features
with arcpy.da.SearchCursor(fl, ['OBJECTID']) as cursor:
    for row in cursor:
        # Find OBJECTID of the row
        oid = row[0]
        # Select the row
        where_clause = "{} = {}".format(arcpy.AddFieldDelimiters(fl, "OBJECTID"), oid)
        arcpy.management.SelectLayerByAttribute(fl, "NEW_SELECTION", where_clause)
        #zoom to selection
        mf.zoomToAllLayers(True)
        #go back to correct scale
        mf.camera.scale = 5000&lt;/LI-CODE&gt;&lt;P&gt;However, the scale is not set to 5000. Adding a print(mf.camera.scale) shows how most of the time, the scale is at 2812,4999999999 (from when I zoomed to the feature), and only a handful of times it is 4999,999999999.&lt;/P&gt;&lt;P&gt;The map frame properties display options are set to none. I would really like to understand why it doesn't set the scale, especially why it does so for a few features but not all?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2024 14:20:30 GMT</pubDate>
    <dc:creator>IlkaIllers1</dc:creator>
    <dc:date>2024-06-21T14:20:30Z</dc:date>
    <item>
      <title>Set camera scale for map frame with Pythong</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495949#M84833</link>
      <description>&lt;P&gt;I am zooming to all features of a feature class and then setting the map scale to 5000.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;aprx= arcpy.mp.ArcGISProject(aprx)
l = aprx.listLayouts("Layout")[0]
mf = l.listElements('MAPFRAME_ELEMENT','Map Frame')[0]
#make feature layer or points
f2 = fc
#make feature layer
fl = arcpy.management.MakeFeatureLayer(f2,f2)
#loop through features
with arcpy.da.SearchCursor(fl, ['OBJECTID']) as cursor:
    for row in cursor:
        # Find OBJECTID of the row
        oid = row[0]
        # Select the row
        where_clause = "{} = {}".format(arcpy.AddFieldDelimiters(fl, "OBJECTID"), oid)
        arcpy.management.SelectLayerByAttribute(fl, "NEW_SELECTION", where_clause)
        #zoom to selection
        mf.zoomToAllLayers(True)
        #go back to correct scale
        mf.camera.scale = 5000&lt;/LI-CODE&gt;&lt;P&gt;However, the scale is not set to 5000. Adding a print(mf.camera.scale) shows how most of the time, the scale is at 2812,4999999999 (from when I zoomed to the feature), and only a handful of times it is 4999,999999999.&lt;/P&gt;&lt;P&gt;The map frame properties display options are set to none. I would really like to understand why it doesn't set the scale, especially why it does so for a few features but not all?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495949#M84833</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2024-06-21T14:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set camera scale for map frame with Pythong</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495966#M84840</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GISWilliamEdwards_0-1718980525940.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107646i69AEE8D10CEF4758/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GISWilliamEdwards_0-1718980525940.png" alt="GISWilliamEdwards_0-1718980525940.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Try this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; hopefully this works. This is a snippet from my code from a tool I have.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:35:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495966#M84840</guid>
      <dc:creator>GISWilliamEdwards</dc:creator>
      <dc:date>2024-06-21T14:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set camera scale for map frame with Pythong</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495967#M84841</link>
      <description>&lt;P&gt;To clarify its the decimal placement that actually fixed a similar issue I was having.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:36:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495967#M84841</guid>
      <dc:creator>GISWilliamEdwards</dc:creator>
      <dc:date>2024-06-21T14:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set camera scale for map frame with Pythong</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495984#M84842</link>
      <description>&lt;P&gt;Just adding the decimal point to the scale? No, unfortunately that didn't solve it.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1495984#M84842</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2024-06-21T14:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set camera scale for map frame with Pythong</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1497056#M84916</link>
      <description>&lt;P&gt;I solved the problem by repeating the line, so it says twice mf.camera.scale = 5000. This seems like it might be a bug, I shouldn't have to repeat this, right? But for now it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 11:10:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/set-camera-scale-for-map-frame-with-pythong/m-p/1497056#M84916</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2024-06-25T11:10:48Z</dc:date>
    </item>
  </channel>
</rss>

