<?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 clip to shape in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712903#M55302</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can i use python to set the dataframe's range as a shapefile,hope for you reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jul 2016 03:24:33 GMT</pubDate>
    <dc:creator>王伟</dc:creator>
    <dc:date>2016-07-26T03:24:33Z</dc:date>
    <item>
      <title>clip to shape</title>
      <link>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712903#M55302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can i use python to set the dataframe's range as a shapefile,hope for you reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 03:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712903#M55302</guid>
      <dc:creator>王伟</dc:creator>
      <dc:date>2016-07-26T03:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: clip to shape</title>
      <link>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712904#M55303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have any experience of writing geometries?&lt;/P&gt;&lt;P&gt;Start here :&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/writing-geometries.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/python/writing-geometries.htm"&gt;Writing geometries—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;And see the various properties of the data frame in the mapping module.&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jul 2016 07:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712904#M55303</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2016-07-26T07:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: clip to shape</title>
      <link>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712905#M55304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out the thread &lt;A href="https://community.esri.com/thread/179279" target="_blank"&gt;Create a polygon from data frame&lt;/A&gt; which has several options for creating a polygon from an extent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/19932" target="_blank"&gt;Darren Wiens&lt;/A&gt; code (copied below) might be you simplest solution, just need to change the output to a shapefile.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument(&lt;SPAN class="string"&gt;"CURRENT") &lt;SPAN class="comment"&gt;# map&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;
df = arcpy.mapping.ListDataFrames(mxd)[&lt;SPAN class="number"&gt;0] &lt;SPAN class="comment"&gt;# get 1st data frame&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;
sr = df.spatialReference &lt;SPAN class="comment"&gt;# get spatial reference&amp;nbsp; &lt;/SPAN&gt;
ext = df.extent &lt;SPAN class="comment"&gt;# extent object&amp;nbsp; &lt;/SPAN&gt;
BL = arcpy.Point(ext.XMin,ext.YMin) &lt;SPAN class="comment"&gt;# bottom left&amp;nbsp; &lt;/SPAN&gt;
BR = arcpy.Point(ext.XMax,ext.YMin) &lt;SPAN class="comment"&gt;# bottom right&amp;nbsp; &lt;/SPAN&gt;
TR = arcpy.Point(ext.XMax,ext.YMax) &lt;SPAN class="comment"&gt;# top right&amp;nbsp; &lt;/SPAN&gt;
TL = arcpy.Point(ext.XMin,ext.YMax) &lt;SPAN class="comment"&gt;# top left&amp;nbsp; &lt;/SPAN&gt;
df_poly = arcpy.Polygon(arcpy.Array([[BL,BR,TR,TL,BL]]),sr) &lt;SPAN class="comment"&gt;# create polygon&amp;nbsp; &lt;/SPAN&gt;
arcpy.CopyFeatures_management(df_poly,r&lt;SPAN class="string"&gt;'in_memory\poly') &lt;SPAN class="comment"&gt;# write to disk&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is not what you are trying to do, you may need to supply additional information (Desktop or Pro, version, etc)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/clip-to-shape/m-p/712905#M55304</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-12T06:32:27Z</dc:date>
    </item>
  </channel>
</rss>

