geoanon2

Python shapefile List for geoprocessing

Discussion created by geoanon2 on Jun 12, 2014
Latest reply on Jun 12, 2014 by mdenil
Hi, I have a python script where the user adds 10 shapefiles or geodatabse features that could be anywhere. Then each of the 10 shapefiles/gdb features are run through a few different tools (buffer, clip, intersect...) What is the best way to get all 10 shapes or geodatabase features into a list and then run the set of tools on the list. It seem like this would be much easier and quicker then copying all the tools 10 times. What is the recommended way to handle this task or get a list like using arcpy.ListFeatureClasses() but for a group of user supplied datasets.

Something that would look similar to this partial script

import arcpy
from arcpy import env
import os
env.workspace = "C:\Users\a\Desktop\DELME"
output = "C:\Users\a\Desktop\FOLDER2\"
data1 = "C:\Users\a\Desktop\FOLDER1\POLYGON1.shp"
data2 = "C:\Users\a\Desktop\DELME\SpatialData\POLYGON2.shp"

fcList = []
fcList.append([data1, data2])
for fc in fcList:
    arcpy.Buffer_analysis(fc, output,  "100 FEET")

Outcomes