im trying to create an automated mapping script, need help

المشرف العام

Administrator
طاقم الإدارة
import arcpy, os mxd = arcpy.mapping.MapDocument(r"c:\users\oberetey\Desktop\cc\gis\shapefiles\TESTRUNucage.mxd") df = arcpy.mapping.ListDataFrames(mxd, "age")[0] outpath = r"c:\top\output\\" finalPdf = arcpy.mapping.PDFDocumentCreate(outPath + "UC_age.pdf") if arcpy.Exists(finalPdf): arcpy.Delete_management(finalPdf) layersList = arcpy.mapping.ListLayers(mxd, "", df) for mapLayer in layerList: if mapLayer.name != "Stateboundary": mapLayer.visible = False arcpy.RefreshTOC() lyrNameList = ["Total; Estimate; Total population", "Total; Margin of Error; Total population", "Male; Estimate; Total population", \ "Male; Margin of Error; Total population", "Female; Estimate; Total population"] for lyrNameList in lyrNameList: lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0] lyr.visible = True for elm in arcpy.mapping.ListLayoutsElements(mxd, "TEXT_ELEMENT"): if elm.text.find("age")>= 0: elm.text = "Texas " + lyrName + " age" tmpPdf= outpath + lyrname + "temp.pdf" arcpy.mapping.ExportToPDF(mxd, tmpPdf) finalPdf.appendPages(tmpPdf) lyr.visible = False del lyr, tmpPdf del mxd, df, finalPdf # i keep getting this error Traceback (most recent call last): File "C:/Users/oberetey/Desktop/Python/test/automatedmappingtest", line 3, in df = arcpy.mapping.ListDataFrames(mxd, "age")[0] IndexError: list index out of range >>>

أكثر...
 
أعلى