Hi, I am trying to use arcpy to run a select by location and export the resulting selection (intersect) as a new feature class. I have set my workspace to the gdb containing the featureclasses I want to select by, and the features I want to select are a tile index feature class called 'tile_index'. The code will run but doesn't have any output. Any help would be great.
Thanks!
<SPAN class="comment token"># Import arcpy and set path to data</SPAN>
<SPAN class="keyword token">import</SPAN> arcpy
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\folder\Data.gdb\"</SPAN>
<SPAN class="comment token"># Get the list of the featureclasses to process</SPAN>
fc_tables <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> fc_tables<SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByLocation_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'fc'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'intersect'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'tile_index'</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN>fc_tables<SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"C:\Data.gdb\%Name%_selection"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>