I wondering if something like this is possible. I would like to create a PDF output using a pre-established map template. The tricky part is I want to create maps in batch by adding (what will usually be 2)feature classes as layers to a data frame in the map document. These feature classes have similar names, the only difference is one of the names is preceded by "buffer_". The feature classes will then be symbolized. I am very new to arcpy mapping and seems like this may be possible however, I am stumped as to how to do this. The limited code I have so far (which doesn't run properly) looks as follows:
import arcpy, os, fnmatch
from arcpy import env
mapTemplate = arcpy.mapping.MapDocument(r"template location")
try:
df = arcpy.mapping.ListDataFrames(mapTemplate)[1]
print df
arcpy.env.workspace = r"file geodatabase"
fc = arcpy.ListFeatureClasses()
for fcs in fc:
name = fcs.getValue().replace("Buffer_","")
for i in os.listdir("file geodatabase"):
if fnmatch.fnmatch(i, name):
arcpy.MakeFeatureLayer_management(fcs, "fc_layer")
layer = arcpy.mapping.Layer("fc_layer")
arcpy.mapping.AddLayer(df, layer + fcs, "AUTO_ARRANGE")
mapTemplate.save()
except Exception, e:
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
I know this is no where close but I am having trouble even using the .getValue statement for the feature classes. Thanks for any suggestions or help you can provide.