12

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.

5
  • 1
    What have you found for older versions of ArcGIS, and what makes them unsuitable for use with ArcGIS 10?
    – nmpeterson
    Commented Feb 7, 2012 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
    Commented Feb 7, 2012 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
    Commented Feb 7, 2012 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
    Commented Feb 7, 2012 at 19:06
  • @whuber Not as it is, needs changes that may not be obvious. Radar - You're right, they're simpler =)
    – SaultDon
    Commented Feb 7, 2012 at 19:55

5 Answers 5

17

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')), '')
1
  • Absolutely perfect though classic type cursor!!
    – Learner
    Commented Jun 1, 2015 at 11:48
8

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

1
2

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.

-1

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.

1
  • 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
    Commented Feb 7, 2012 at 19:07
-1

The Split tool in ArcGIS does exactly this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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