<?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: Help with MapFrame panToExtent in ArcGIS Pro 2.9 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313276#M68286</link>
    <description>&lt;P&gt;Try setting the symbolized_extent to False so it works off the geometry?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mf.getLayerExtent(lyr, False, False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jul 2023 21:32:57 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2023-07-28T21:32:57Z</dc:date>
    <item>
      <title>Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313256#M68283</link>
      <description>&lt;P&gt;I've written an arcpy script that pulls coordinate data from a saved email/text file.&amp;nbsp; I've also added the polygon created into a feature class, and used a definition query on the layer so that the new feature is the only one visible in the map.&lt;/P&gt;&lt;P&gt;What I'm trying to do is &lt;U&gt;pan&lt;/U&gt; the layout's map frame to the new extent of the layer.&amp;nbsp; The following script works (i.e. retains the current scale of the map frame, and pans to the layer), but it throws the included error.&amp;nbsp; I'm running my script in ArcGIS Pro 2.9.&lt;/P&gt;&lt;P&gt;I've already read the MapFrame and Camera classes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A title="MapFrame" href="https://pro.arcgis.com/en/pro-app/2.9/arcpy/mapping/mapframe-class.htm" target="_self"&gt;https://pro.arcgis.com/en/pro-app/2.9/arcpy/mapping/mapframe-class.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Camera" href="https://pro.arcgis.com/en/pro-app/2.9/arcpy/mapping/camera-class.htm" target="_self"&gt;https://pro.arcgis.com/en/pro-app/2.9/arcpy/mapping/camera-class.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't find ANY examples of how to use the MapFrame panToExtent method.&amp;nbsp; Please help.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("811Tickets")[0]
lyr = m.listLayers("AZ811 BlueStake")[0]
lyt = aprx.listLayouts()[0]
mf = lyt.listElements("mapframe_element", "MainMapFrame")[0]
mf.camera.setExtent(mf.panToExtent(mf.getLayerExtent(lyr, False, True)))
Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 6, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 389, in setExtent
    return convertArcObjectToPythonObject(self._arc_object.setExtent(*gp_fixargs((extent,), True)))
TypeError: Camera.setExtent() missing required argument 'extent' (pos 1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 20:39:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313256#M68283</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2023-07-28T20:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313267#M68284</link>
      <description>&lt;P&gt;I don't think the&lt;/P&gt;&lt;PRE&gt;mf.panToExtent(lyrExt)&lt;/PRE&gt;&lt;P&gt;returns anything so nesting it into the setExtent method is passing it None.&lt;/P&gt;&lt;P&gt;try separating them and passing in the extent.&lt;/P&gt;&lt;PRE&gt;lyrExt = mf.getLayerExtent(lyr&lt;SPAN&gt;, False, True&lt;/SPAN&gt;)&lt;BR /&gt;mf.panToExtent(lyrExt)&lt;BR /&gt;mf.camera.setExtent(lyrExt)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 20:53:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313267#M68284</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-07-28T20:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313275#M68285</link>
      <description>&lt;P&gt;Thanks for your help&amp;nbsp;@Anonymous User&amp;nbsp;.&amp;nbsp; Unfortunately, when I tried your suggestion...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("811Tickets")[0]
lyr = m.listLayers("AZ811 BlueStake")[0]
lyt = aprx.listLayouts()[0]
mf = lyt.listElements("mapframe_element", "MainMapFrame")[0]
lyrExt = mf.getLayerExtent(lyr, False, True)
mf.panToExtent(lyrExt)
mf.camera.setExtent(lyrExt)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I found that it works the same as...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("811Tickets")[0]
lyr = m.listLayers("AZ811 BlueStake")[0]
lyt = aprx.listLayouts()[0]
mf = lyt.listElements("mapframe_element", "MainMapFrame")[0]
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))&lt;/LI-CODE&gt;&lt;P&gt;I'm trying to stay at a scale of 1:25,200, but the both of these scripts zoom to the feature's/layer's extent.&lt;/P&gt;&lt;P&gt;If I figure it out, I'll post my corrected script.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 21:13:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313275#M68285</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2023-07-28T21:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313276#M68286</link>
      <description>&lt;P&gt;Try setting the symbolized_extent to False so it works off the geometry?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mf.getLayerExtent(lyr, False, False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 21:32:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313276#M68286</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-07-28T21:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313295#M68287</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;&amp;nbsp;Thanks for your suggestions.&amp;nbsp; I FINALLY figured it out.&amp;nbsp; I set the mf.camera.scale.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps("811Tickets")[0]
lyr = m.listLayers("AZ811 BlueStake")[0]
lyt = aprx.listLayouts()[0]
mf = lyt.listElements("mapframe_element", "MainMapFrame")[0]
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))
mf.camera.scale = 25200.0&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Jul 2023 22:47:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1313295#M68287</guid>
      <dc:creator>Shauna-RaeBrown</dc:creator>
      <dc:date>2023-07-28T22:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with MapFrame panToExtent in ArcGIS Pro 2.9</title>
      <link>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1516626#M71224</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I tried following this example (from the solution) and I am having trouble.&amp;nbsp; The script is finding the correct map, layer, layout, and mapframe but nothing seems to happen when I run the script.&amp;nbsp; How can I debut this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;#find the Layers Map&lt;BR /&gt;m = aprx.listMaps("Layers")[0]&lt;BR /&gt;#Find the AOI layer&lt;BR /&gt;lyr = m.listLayers("AOI")[0]&lt;BR /&gt;#Get the first (0) layout&lt;BR /&gt;lyt = aprx.listLayouts()[1]&lt;BR /&gt;#Get the mapframe element called MainMapFrame&lt;BR /&gt;mf = lyt.listElements("mapframe_element", "MainMapFrame")[0]&lt;BR /&gt;#Pan to the extent of the AOI layer in my Layers Map&lt;BR /&gt;mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))&lt;BR /&gt;#Dont worry about setting an extent&lt;BR /&gt;#mf.camera.scale = 25200.0&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 12:46:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-mapframe-pantoextent-in-arcgis-pro-2-9/m-p/1516626#M71224</guid>
      <dc:creator>LyonMNGIS</dc:creator>
      <dc:date>2024-08-08T12:46:13Z</dc:date>
    </item>
  </channel>
</rss>

