Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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?

share|improve this question
Do your 8000 polygons have any overlap between them? – PolyGeo Jan 25 '13 at 10:35
No, they are equal-area triangle polygons which share edges but no overlaps. – joosthoek Jan 25 '13 at 10:45
up vote 2 down vote accepted

Because your polygons do not overlap I think you should try Intersect from the Analysis toolbox.

share|improve this answer
That did the trick! – joosthoek Jan 25 '13 at 11:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.