I wrote this script for performin an union operation between 2 lists of files.
Files have different names but end with the same number. Files are in the same directory.
Wht's wrong in the code?
thanks
#Import modules
import sys, string, os, arcgisscripting
gp = arcgisscripting.create(9.3)
gp.CheckOutExtension("Spatial")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
pathA = sys.argv[1]
outWorkspace = sys.argv[2]
gp.workspace = pathA
try:
FeatsA = gp.ListFeatureClasses("A_*","POLYGONS")
FeatsB = gp.ListFeatureClasses("B_*","POLYGONS")
for FeatA in FeatsA:
for FeatB in FeatsB:
if FeatA[1:2] == FeatB[1:2]:
outfeat = outWorkspace + "\\union_" + str(FeatB)
gp.Union_analysis(FeatA + ";" + FeatB, outfeat, "ALL", "", "GAPS"); showGpMessage()
except:
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()