I'm trying to create .mxd and PDF outputs for a series of feature classes in an SDE. I'll need to match 2 feature classes (one original, one buffered) in the SDE based on similar file names. The buffered FC will simply be prefaced with 'Buffer_' prior to sharing the original file path name. I'm trying to bring both feature classes into a new mxd, zoom to the extent of the buffered feature class as it will naturally occupy more area, symbolize the 2 layers and create a saved mxd and pdf based on the features and repeat this process for subsequent buffered feature classes and original feature classes.
I'm stuck trying to get the buffered and original feature classes to match and as a result be added to the map as a layer. So far I am able to create the new mxd and set the zoom extent. The code I'm stuck on is as follows:
arcpy.env.workspace = "SDE"
fcList = sorted(arcpy.ListFeatureClasses('Buffer_*'))
matchFClist = arcpy.ListFeatureClasses()
for fc in fcList:
print fc
fcclean = fc.replace('Buffer_','')
copymxd = templatemxd.saveACopy(r"Folder\\" + fcclean + ".mxd")
mxd = arcpy.mapping.MapDocument(r"Q:\outputFolder\TMaps\\" + fcclean + ".mxd")
df = arcpy.mapping.ListDataFrames(mxd,"*")[0]
for fcclean in matchFClist:
if fnmatch.fnmatch(fcclean, matchFClist):
newlayer = arcpy.mapping.Layer(fcclean)
newMatchlayer = arcpy.mapping.Layer(matchFClist)
I know this is probably way off however, but I'm not sure how to get the match to work. I could always try using an array as well however, I'm pretty confused at this point.
fcclean
and for certain steps afterwards to help you see what's going on, or where the code is failing. Also is this code meant to be standalone or run within each mxd?