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've come across a few similar questions for older versions of ArcGIS, but haven't found a suitable answer for ArcGIS 10.

I have two polygon shapefiles that cover a large area (e.g. an entire State/Province). The first shapefile represents land cover for the entire State and the second represents 50 individual watersheds. I would like to clip the land cover shapefile based on each watershed (each has a unique name stored in a field). I would then like to save the output clipped files (one for each of the 50 watersheds) using the watershed name.

Given that there are 50 clips to be performed this process is a great candidate for batch processing.

share|improve this question
1  
What have you found for older versions of ArcGIS, and what makes them unsuitable for use with ArcGIS 10? –  nmpeterson Feb 7 '12 at 18:30
2  
@Radar Take a look at this question: gis.stackexchange.com/q/8104/1297 It covers what you are looking for. If you need any help modifying for your needs, let me know. I've flagged this as a possible duplicate. –  SaultDon Feb 7 '12 at 18:41
    
@SaultDon: Are you saying that the solution(s) at gis.stackexchange.com/q/8104/1297 will definitely also work in ArcGIS 10? –  whuber Feb 7 '12 at 19:03
    
@SaultDon - Some changes have been made to cursors in ArcGIS 10 that cause that particular answer to be outdated. I'm hoping to find the best solution for Arc10 and not just a hacked version of a 9.3 script. –  Radar Feb 7 '12 at 19:06
    
@whuber Not as it is, needs changes that may not be obvious. Radar - You're right, they're simpler =) –  SaultDon Feb 7 '12 at 19:55
add comment

4 Answers

up vote 8 down vote accepted

The following script clips polygon watersheds to polygon county boundaries, naming each output featureclass something like HspWBD_HU12_county name. Tested and it works. Make sure your values in the NAME field have no special characters or spaces (simple Python string methods can clean that up for you).

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')), '')
share|improve this answer
    
Perfect. Ran a quick test and it works just fine. Thanks @Chad! –  Radar Feb 7 '12 at 19:28
add comment

As you use ArcGIS 10, i would use modelbuilder with builtin tool: Iteration Feature Selection to perform this task. See the pseudo-model in the picture. it does not need to know python scritping at all. pseudo model

share|improve this answer
    
For a deeper explanation of this approach see Easily clip an entire workspace for a specific study area, and associated Clip Workspace geoprocessing tool package. –  matt wilkie Dec 3 '12 at 21:01
add comment

This sounds exactly like what the Split tool from the Analysis toolbox does.

However, it requires an ArcInfo license to run so is not available to the majority of ArcGIS Desktop users so I like Chad's answer which will work for ArcGIS 10 Desktop users with ArcView and ArcEditor level licenses too.

share|improve this answer
add comment

You can do this the way you want if you run another tool in batch mode first: Conversion Tools > To Geodatabase > Feature Class to Feature Class. That will let you use an expression to take your watershed layer and pull out each watershed invidividually and save it as its own feature class, then you'll have 50 individual layers you can use with the Clip tool in batch mode.

share|improve this answer
2  
I appreciate the answer, but this doesn't seem to be a very efficient solution. I'd rather not create 50 separate watershed files and then 50 more clipped files. –  Radar Feb 7 '12 at 19:07
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.