<?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: Creating new shapefile based on its attributes with python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-new-shapefile-based-on-its-attributes/m-p/628295#M48933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...don't know if the moderator wants to delete this thread or if sxt128130 can remove it, but this was answered yesterday in a cross-post here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/54927-Creating-Many-Shapefiles-Features-using-Python-Model-Builder-from-one-Shapefile" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/54927-Creating-Many-Shapefiles-Features-using-Python-Model-Builder-from-one-Shapefile&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The basic answer offered, copied from that post (also, thanks to Mathew Coyle and Dan Patterson for the earlier guidance)-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy fc = "D:\\2010.shp" yrs = [1991,1992,1996,1998,1999,2000,2003,2004,2005,2006,2008,2010] subtract = '' for yr in yrs: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = '"Year" &amp;lt;= ' + str(yr) + subtract &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subtract = ' AND "Year" &amp;gt; ' + str(yr) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = str(yr) + '.shp' &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(fc, "D:\\test output", filename, where)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 09 Dec 2012 13:45:35 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2012-12-09T13:45:35Z</dc:date>
    <item>
      <title>Creating new shapefile based on its attributes with python</title>
      <link>https://community.esri.com/t5/python-questions/creating-new-shapefile-based-on-its-attributes/m-p/628294#M48932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a shapefile which has an attribute year. I used to generally copy and paste these features in the dataframe and then using the definition query just show polygons which were established before that year.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to know how can I do it using python. Like if I can give the input feature class, add all the years I want the different shapefiles for and the workspace where it can create shapefile for the mentioned years with the right naming convention.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank You.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Dec 2012 18:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-new-shapefile-based-on-its-attributes/m-p/628294#M48932</guid>
      <dc:creator>SenthilnathanThyagarajan</dc:creator>
      <dc:date>2012-12-08T18:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new shapefile based on its attributes with python</title>
      <link>https://community.esri.com/t5/python-questions/creating-new-shapefile-based-on-its-attributes/m-p/628295#M48933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...don't know if the moderator wants to delete this thread or if sxt128130 can remove it, but this was answered yesterday in a cross-post here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/54927-Creating-Many-Shapefiles-Features-using-Python-Model-Builder-from-one-Shapefile" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/54927-Creating-Many-Shapefiles-Features-using-Python-Model-Builder-from-one-Shapefile&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The basic answer offered, copied from that post (also, thanks to Mathew Coyle and Dan Patterson for the earlier guidance)-- &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy fc = "D:\\2010.shp" yrs = [1991,1992,1996,1998,1999,2000,2003,2004,2005,2006,2008,2010] subtract = '' for yr in yrs: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = '"Year" &amp;lt;= ' + str(yr) + subtract &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subtract = ' AND "Year" &amp;gt; ' + str(yr) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = str(yr) + '.shp' &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(fc, "D:\\test output", filename, where)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Dec 2012 13:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-new-shapefile-based-on-its-attributes/m-p/628295#M48933</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-09T13:45:35Z</dc:date>
    </item>
  </channel>
</rss>

