Arcpy mapping text element reset

المشرف العام

Administrator
طاقم الإدارة
Hey guys I am writing a script to create thousands of maps and I am trying to create a table that updates for every map. Basically an updating table of the information specific to each map. I have been trying to link a an excel table to the layout view but arc does not seem to have that functionality. So what I am doing instead is creating a manual table in the layout view. I have 27 values for each map that I have been storing in a dictionary (using searchcursors to extract the info and store into dictionary).

I cannot copy and paste my table into here but it essentially looks this:

Receptors AEGbuffer 2ndbuffer 3rdbufferreceptor1 1 10 19receptor2 2 11 20 receptor3 3 12 21receptor4 4 13 22receptor5 5 14 23receptor6 6 15 24receptor7 7 16 25receptor8 8 17 26receptor9 9 18 27for k,v in sorted(table.items()): for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): if elm.text == "1": if k == 'AEGbuffer': elm.text= v if elm.text == "2": if k == 'AEGschools': elm.text = v if elm.text == "3": if k == 'AEGchildcares': elm.text = v if elm.text == "4": if k == 'AEGhospitals': elm.text = v if elm.text == "5": if k == 'AEGnursinghomes': elm.text = v if elm.text == "6": if k == 'AEGcritical': elm.text = v if elm.text == "7": if k == 'AEGsw': elm.text = v if elm.text == "8": if k == 'AEGstreams': elm.text = v if elm.text == "9": if k == 'AEGrespop': elm.text = vthis is just for the first row, the rest of the code is the same process for the pasting of the dictionary values.

where I am stuck: I do not know how to properly reset the newly changed values to their original 1-27 values so the next map can be easily produced. is there a tool or trick to this?

what I have tried: after I export the map I reopen the text elements and reverse the process like..

for k,v in sorted(table.items()): for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): if k == 'AEGbuffer': if elm.text == v: elm.text = "1" and so on......but this approach hasn't worked great. a few of the values are wrong when there are the same values a few times on the table. any pointers or hints would be much appreciated.



أكثر...
 
أعلى