I have two shapefiles, one is polyline, the other polygon. For each polygon I would like to clip the polyline vectors inside. Using arcpy I already found part of a possible solution: http://gis.stackexchange.com/a/19934/6458
import arcpy
arcpy.env.workspace = r'D:\Projects\GDBs\slowbutter.gdb\IPAS'
rows = arcpy.SearchCursor('HspAOI')
for row in rows:
feat = row.Shape
arcpy.Clip_analysis('HspWBD_HU12', feat, 'HspWBD_HU12_' + str(row.getValue('NAME')), '')
This however would create a new shapefile per polygon. I have 8000 polygons and would have to merge these using arcpy.Merge_management().
Is there maybe a way to not have to merge 8000 separate shapefiles? I work with arcpy and ogr so the latter might also be an option?