<?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 how to extent of the map view in arcgis pro to the same size as polygon's feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022033#M59724</link>
    <description>&lt;P&gt;How to extent of the map view as an image format in arcgis pro to the same size as polygon's feature class?&lt;/P&gt;&lt;P&gt;From converting this code&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;mv = aprx.activeView&lt;/P&gt;&lt;P&gt;# Change the extent of the map view&lt;BR /&gt;ext = mv.camera.getExtent()&lt;BR /&gt;ext.XMin = ext.XMin&lt;BR /&gt;ext.YMin = ext.YMin&lt;BR /&gt;ext.XMax = ext.XMax&lt;BR /&gt;ext.YMax = ext.YMax&lt;BR /&gt;mv.camera.setExtent(ext)&lt;BR /&gt;Output_File = os.path.join(arcpy.env.scratchFolder, 'ActiveMapView3.png')&lt;BR /&gt;mv.exportToPNG(Output_File, width=1000, height=1000)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Feb 2021 10:03:55 GMT</pubDate>
    <dc:creator>cinnaaaoo</dc:creator>
    <dc:date>2021-02-01T10:03:55Z</dc:date>
    <item>
      <title>how to extent of the map view in arcgis pro to the same size as polygon's feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022033#M59724</link>
      <description>&lt;P&gt;How to extent of the map view as an image format in arcgis pro to the same size as polygon's feature class?&lt;/P&gt;&lt;P&gt;From converting this code&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;mv = aprx.activeView&lt;/P&gt;&lt;P&gt;# Change the extent of the map view&lt;BR /&gt;ext = mv.camera.getExtent()&lt;BR /&gt;ext.XMin = ext.XMin&lt;BR /&gt;ext.YMin = ext.YMin&lt;BR /&gt;ext.XMax = ext.XMax&lt;BR /&gt;ext.YMax = ext.YMax&lt;BR /&gt;mv.camera.setExtent(ext)&lt;BR /&gt;Output_File = os.path.join(arcpy.env.scratchFolder, 'ActiveMapView3.png')&lt;BR /&gt;mv.exportToPNG(Output_File, width=1000, height=1000)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 10:03:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022033#M59724</guid>
      <dc:creator>cinnaaaoo</dc:creator>
      <dc:date>2021-02-01T10:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to extent of the map view in arcgis pro to the same size as polygon's feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022067#M59727</link>
      <description>&lt;P&gt;I think you can just use the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapframe-class.htm" target="_self"&gt;MapFrame&lt;/A&gt; class to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")

m = aprx.listMaps("Yose*")[0]
lyr = m.listLayers("Ranger Stations")[0]
lyt = aprx.listLayouts("Main Attr*")[0]
mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0]
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))

aprx.exportToPNG(out_png, {resolution}, {world_file}, {color_mode}, {embed_color_profile})
del aprx&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 13:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022067#M59727</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-01T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to extent of the map view in arcgis pro to the same size as polygon's feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022115#M59738</link>
      <description>&lt;P&gt;I don't understand the coding of these 3 lines.&lt;/P&gt;&lt;P&gt;lyr = m.listLayers("Ranger Stations")[0]&lt;BR /&gt;lyt = aprx.listLayouts("Main Attr*")[0]&lt;BR /&gt;mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0]&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 15:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022115#M59738</guid>
      <dc:creator>cinnaaaoo</dc:creator>
      <dc:date>2021-02-01T15:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to extent of the map view in arcgis pro to the same size as polygon's feature class</title>
      <link>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022134#M59741</link>
      <description>&lt;P&gt;Those are from the example in the Docs.&lt;/P&gt;&lt;P&gt;lyr = m.listLayers("Ranger Stations")[0]&amp;nbsp; &amp;lt; replace with the name of the layer in your project that you want to get the extent from&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;lyt = aprx.listLayouts("Main Attr*")[0]&amp;nbsp; &amp;lt; replace with your layout name in your project&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0]&amp;nbsp; &amp;lt; replace 'Yosemite National Park' with your element name from your layout&lt;/P&gt;&lt;P&gt;Take a read of the Discussion in the docs.&amp;nbsp; It explains the Layout and ListElements methods.&amp;nbsp; &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapframe-class.htm" target="_self"&gt;MapFrame&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 15:39:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-extent-of-the-map-view-in-arcgis-pro-to-the/m-p/1022134#M59741</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-01T15:39:21Z</dc:date>
    </item>
  </channel>
</rss>

