Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.