I was working on this a bit ago and had something which I thought worked however, it does not seem to be working at the moment. What I'm trying to do is match feature classes having similar files. One will be a buffered version of the original and have 'Buffer_' in the name the other will simply be the original feature class. I'd like to then bring the buffered version and original feature class into a .mxd, symbolize both, create a legend, save the .mxd and export the map to a pdf. Everything is working as it should with the exception of getting the buffered feature class to match it's original.
I am able to bring the buffered feature class into the .mxd, rename the .mxd to the name of the buffered feature class. I am also able to bring in an original feature class to the map document however, it is not the original feature class which corresponds to the buffered feature class.
The portion of my code which attempts to match the 2 feature classes looks like:
buffered = arcpy.ListFeatureClasses('Buffer_*') original = [buffer.split("Buffer_")[-1] for buffer in buffered] fccount = -1 buffered.sort() for fc in buffered: fccount += 1 print fc + " " + str(fccount) #REPLACE sandbox WITH tip_2014 fcclean = fc.replace('tBuffer_','') print "fcclean = " + fcclean copymxd = templatemxd.saveACopy(r"map output directory\\" + fcclean + ".mxd") print "Saved Copy" mxd = arcpy.mapping.MapDocument(r"map output directory\\" + fcclean + ".mxd") print "MXD set" df = arcpy.mapping.ListDataFrames(mxd,"*") buffLayer = arcpy.mapping.Layer(buffered[fccount]) orgLayer = arcpy.mapping.Layer(original[fccount])
I have a feeling I am missing something with the count but am puzzled as to what. Thanks for any help you can provide with this issue.