<?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>idea Set the Extent of a MapView Object in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idi-p/1557714</link>
    <description>&lt;P&gt;The ArcPy Camera object, utilized by both MapView and MapFrame objects, is currently broken for usage within a MapView. This flaw is acknowledged in the documentation for Camera.setExtent(): "Sets the Extent for a map frame &lt;STRONG&gt;in a layout&lt;/STRONG&gt;." A camera object obtained from MapView.defaultCamera can have setExtent() called on it, but the Extent of the MapView will not change.&lt;/P&gt;
&lt;P&gt;My suggestion is that Camera.setExtent() gets implemented for all instances of Camera, including Camera objects used by MapView objects. This would enable functionality for the Extent of an Active Map to be modified by ArcPy. An active map in a project should have this functionality just like a MapFrame in a Layout does.&lt;/P&gt;
&lt;P&gt;I tried to design a script that pans the active map to specific features, but this is currently not possible with the broken implementation of the Camera object. Fixing this implementation will help my workflow in many ways because I will be able to easily pan the map to my selected features with a single function. Currently I have to Select By Attributes and then Zoom To Selection which is tedious when reviewing large numbers of features.&lt;/P&gt;
&lt;P&gt;If implemented, a user may be able to do something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;arcpy.management.SelectLayerByAttribute(layer, "NEW_SELECTION", f"OBJECTID = {oid}")
aprx = arcpy.mp.ArcGISProject("CURRENT")
map_view = aprx.activeMap
map_view.defaultCamera.setExtent(getLayerExtent(...))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 15:14:30 GMT</pubDate>
    <dc:creator>wtfineberg</dc:creator>
    <dc:date>2024-11-13T15:14:30Z</dc:date>
    <item>
      <title>Set the Extent of a MapView Object</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idi-p/1557714</link>
      <description>&lt;P&gt;The ArcPy Camera object, utilized by both MapView and MapFrame objects, is currently broken for usage within a MapView. This flaw is acknowledged in the documentation for Camera.setExtent(): "Sets the Extent for a map frame &lt;STRONG&gt;in a layout&lt;/STRONG&gt;." A camera object obtained from MapView.defaultCamera can have setExtent() called on it, but the Extent of the MapView will not change.&lt;/P&gt;
&lt;P&gt;My suggestion is that Camera.setExtent() gets implemented for all instances of Camera, including Camera objects used by MapView objects. This would enable functionality for the Extent of an Active Map to be modified by ArcPy. An active map in a project should have this functionality just like a MapFrame in a Layout does.&lt;/P&gt;
&lt;P&gt;I tried to design a script that pans the active map to specific features, but this is currently not possible with the broken implementation of the Camera object. Fixing this implementation will help my workflow in many ways because I will be able to easily pan the map to my selected features with a single function. Currently I have to Select By Attributes and then Zoom To Selection which is tedious when reviewing large numbers of features.&lt;/P&gt;
&lt;P&gt;If implemented, a user may be able to do something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;arcpy.management.SelectLayerByAttribute(layer, "NEW_SELECTION", f"OBJECTID = {oid}")
aprx = arcpy.mp.ArcGISProject("CURRENT")
map_view = aprx.activeMap
map_view.defaultCamera.setExtent(getLayerExtent(...))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 15:14:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idi-p/1557714</guid>
      <dc:creator>wtfineberg</dc:creator>
      <dc:date>2024-11-13T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set the Extent of a MapView Object - Status changed to: Closed</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idc-p/1645325#M35996</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/840302"&gt;@wtfineberg&lt;/a&gt;&amp;nbsp;I believe there is a misunderstanding between changing a Map's default Extent property vs changing the extent of an active MapView.&lt;/P&gt;&lt;P&gt;Map.defaultCamera -&amp;nbsp;&lt;EM&gt;Modifying the&amp;nbsp;defaultCamera&amp;nbsp;will not affect an existing view. This property is only applied when a new MapView&amp;nbsp;is opened or a new MapFrame&amp;nbsp;is inserted into a layout.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;You can change the extent of an active MapView using the Camera object, not the defaultCamera property.&amp;nbsp; I've modified the code above slightly to change the active MapView's extent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject('current')
map_view = aprx.activeView
layer = map_view.map.listLayers('GreatLakes')[0]
arcpy.management.SelectLayerByAttribute(layer, "NEW_SELECTION", f"NAME = 'Lake Superior'")
map_view.camera.setExtent(map_view.getLayerExtent(layer, True))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice, I'm using activeView, NOT activeMap.&amp;nbsp; ActiveView returns a MapView object whereas activeMap returns a Map object.&amp;nbsp; It is from the active view that I get the associated map and then reference a layer.&lt;/P&gt;&lt;P&gt;If I were to then type:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;m = aprx.listMaps('Map')[0]
m.defaultCamera = map_view.camera&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The next time I go to open a new map view for the 'Map', it will be zoomed to Lake Superior.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Mon, 25 Aug 2025 20:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idc-p/1645325#M35996</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2025-08-25T20:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set the Extent of a MapView Object</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idc-p/1648362#M36105</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;, thank you for the detailed explanation and this code example. This definitely helps me grasp the difference between a Map and a MapView object. Obtaining the MapView object using the activeView property of the ArcGISProject is exactly what I was looking for!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 21:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/set-the-extent-of-a-mapview-object/idc-p/1648362#M36105</guid>
      <dc:creator>wtfineberg</dc:creator>
      <dc:date>2025-09-05T21:37:15Z</dc:date>
    </item>
  </channel>
</rss>

