<?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: Is there a way to create a polygon from a map frame extent in ArcGIS Pro? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1015084#M35802</link>
    <description>&lt;P&gt;Dan this works great as well! Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jan 2021 16:40:04 GMT</pubDate>
    <dc:creator>SterlingL</dc:creator>
    <dc:date>2021-01-08T16:40:04Z</dc:date>
    <item>
      <title>Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014932#M35789</link>
      <description />
      <pubDate>Fri, 08 Jan 2021 00:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014932#M35789</guid>
      <dc:creator>SterlingL</dc:creator>
      <dc:date>2021-01-08T00:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014933#M35790</link>
      <description>&lt;P&gt;You can do it via code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
#Reference the Project document from within PRO
aprx = arcpy.mp.ArcGISProject("CURRENT")
#Reference the layout
lyt = aprx.listLayouts("your_layout_name_here")[0]
#Get the Map Frame
mf = lyt.listElements("mapframe_element", "your_mapframe_name")[0]
extent = mf.camera.getExtent()
polygon = extent.polygon&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You then have a polygon object that you can work with.&lt;/P&gt;&lt;P&gt;Note that this code just grabs the extent, if the map frame is rotated, the extent doesn't match what you see on screen.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 00:26:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014933#M35790</guid>
      <dc:creator>MarkBryant</dc:creator>
      <dc:date>2021-01-08T00:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014939#M35791</link>
      <description>&lt;P&gt;Using tools in ArcToolbox&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-fishnet.htm" target="_blank"&gt;Create Fishnet (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aoi_create_fishnet.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3433iBA4D1A061687DF05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aoi_create_fishnet.png" alt="aoi_create_fishnet.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aoi_create_fishnet1.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3434iBCBC16E84D43C895/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aoi_create_fishnet1.png" alt="aoi_create_fishnet1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 00:41:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014939#M35791</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-08T00:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014942#M35792</link>
      <description>&lt;P&gt;Thank you sir! This worked marvelously.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 00:54:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1014942#M35792</guid>
      <dc:creator>SterlingL</dc:creator>
      <dc:date>2021-01-08T00:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1015084#M35802</link>
      <description>&lt;P&gt;Dan this works great as well! Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 16:40:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1015084#M35802</guid>
      <dc:creator>SterlingL</dc:creator>
      <dc:date>2021-01-08T16:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1336060#M73804</link>
      <description>&lt;P&gt;This worked great! Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2023 14:30:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1336060#M73804</guid>
      <dc:creator>VeraNeroni1</dc:creator>
      <dc:date>2023-10-07T14:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1380958#M78624</link>
      <description>&lt;P&gt;Hi Mark,&lt;BR /&gt;&lt;BR /&gt;Can you please indicate how to save the extent as a feature class? I tried InsertCursor but it didn't accept the polygon object, it requires list of floats instead.&lt;BR /&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Katerina.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 10:19:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1380958#M78624</guid>
      <dc:creator>Katerina1</dc:creator>
      <dc:date>2024-02-12T10:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to create a polygon from a map frame extent in ArcGIS Pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1474177#M83405</link>
      <description>&lt;P&gt;I realise there is a solution here but wanted to add a script for use in an ArcGIS Pro which creates a new polygon row in a feature class based on the current extent. The script also adds a scale from current extent to a field called SCALE (it will need to exist in feature class for it to work).&lt;BR /&gt;&lt;BR /&gt;This is particularly useful for users who are trying to build map books using data driven pages.&lt;BR /&gt;&lt;BR /&gt;Users will just need to create a script within a toolbox and add a parameter that is a feature layer type so that users can input a feature class for it to work. Here is script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;# Import system module&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;# Input parameter for feature class name&lt;BR /&gt;feature_class_name = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;# Extracting the geodatabase path from the feature class name&lt;BR /&gt;geodatabase = "\\".join(feature_class_name.split("\\")[:-1])&lt;/P&gt;&lt;P&gt;# Ensure overwriting of output data&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;# Select the current project map&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/P&gt;&lt;P&gt;# Select the current map layout&lt;BR /&gt;map_layout = aprx.listLayouts()[0]&lt;/P&gt;&lt;P&gt;# Extract the extent of the selected data frame&lt;BR /&gt;map_frame = map_layout.listElements("MAPFRAME_ELEMENT")[0]&lt;BR /&gt;extent = map_frame.camera.getExtent()&lt;BR /&gt;polygon = extent.polygon&lt;/P&gt;&lt;P&gt;# Append a new row to the existing feature class&lt;BR /&gt;arcpy.management.Append([polygon], feature_class_name, "NO_TEST")&lt;BR /&gt;arcpy.AddMessage("Polygon appended to the existing feature class.")&lt;/P&gt;&lt;P&gt;# Get the current layout scale&lt;BR /&gt;current_scale = map_frame.camera.scale&lt;/P&gt;&lt;P&gt;# Check if the SCALE field exists&lt;BR /&gt;field_exists = False&lt;BR /&gt;for field in arcpy.ListFields(feature_class_name):&lt;BR /&gt;if field.name == "SCALE":&lt;BR /&gt;field_exists = True&lt;BR /&gt;break&lt;/P&gt;&lt;P&gt;if not field_exists:&lt;BR /&gt;arcpy.AddError("SCALE field does not exist in the feature class.")&lt;BR /&gt;else:&lt;BR /&gt;# Update SCALE field for the newly added row&lt;BR /&gt;with arcpy.da.UpdateCursor(feature_class_name, "SCALE") as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;row[0] = current_scale&lt;BR /&gt;cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;arcpy.AddMessage("SCALE field updated for the newly added record.")&lt;BR /&gt;&lt;BR /&gt;Hopefully this saves someone some time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 21:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/is-there-a-way-to-create-a-polygon-from-a-map/m-p/1474177#M83405</guid>
      <dc:creator>StuartGrey1</dc:creator>
      <dc:date>2024-05-16T21:29:05Z</dc:date>
    </item>
  </channel>
</rss>

