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')), '')
Follow the instructions in my answer here to use the Fusion's command line PolyClipData
.
Assuming you have:
- shapefiles named tree_0.shp, tree_1.shp,...,tree_138.shp (as stated through comments).
- the las file to be clipped with name
data.las
.
- the fusion software stored directly under the c: drive.
- the shp files and the las file stored under a folder named 'forest'
Write the following command line:
FOR /L %%W IN (0,1,138) DO CALL c:\fusion\polyclipdata /index c:\forest\tree_%%W.shp c:\forest\clipped_data_%%W.las c:\forest\data.las
The FOR /L %%W IN (0,1,138) DO CALL
part is a loop which will take one shapefile at a time to clip your main las file. In this case, the output will be 139 las files clipped by their respective shapefile.
I guess the time of processing will depend on how much is the number of shapefiles and the size of the main las file.
The /L
part is a shortcut, so there is no need to write:
FOR %%W IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,....,138) DO CALL .....
With /L
it reads the following between the brackets: (start,step,end).
The /index
switch creates the .ldx and .ldi files which are necessary for visualization in the Fusion's viewer.
Best Answer
Set up your model as shown below