Auto-updating symbology between *.mxds for same shapefile using arcgisscripting?

I have a variety of .mxds for any one project I'm working on, which are all different but all use the same set of base shapefiles for my project.

I know I can save a .lyr version of my initial shapefile and import this into subsequent .mxds to retain the original symbology I have set, but if I then change the symbology of the original shapefile, even if I save over the .lyr file with the new symbology, nothing updates in any of my existing files?

My question is, is there an easy way to auto-update this symbology, or is it a manual task? If it's a case of manual re-linking then that's a lot of updating I'm going to have to do on a routine basis - so I'm keen to find a simple way of doing this? I have no python experience but if this is the way to do it then I am eager to learn!!

In terms of what I have found so far for a Python solution:

I found this link here on StackExchange, which I think might be a good starting point in terms of Python, as it seems to be a script to auto-update data sources [ How to update shapefile data source in multiple dataframes and mxds using lyr.replaceDataSource and Python dictionary? ]

And also I found this thread on ArcGIS Idea [ http://ideas.arcgis.com/ideaView?id=087300000008FNBAA2 ] albeit dated 2010, which seems to ask the same question as me, and someone has provided a link to some arcpy.mapping sample scripts which again look very similar to what I need, though they seem to do one .mxd at a time which is about the same effort as relinking them manually.

I did download the sample python scripts to have a look at, and I've installed Python (command line), but I have no experience with this and am struggling a bit with knowing where to start to get these to run!

I'm not sure if there's a simpler way of going about this which AUTO links rather than re-running a script with every edit - it seems odd to me that this is not a function built in to ArcGIS?

I am using ArcMap 9.2

• Would you be able to edit your Question to include the version of ArcGIS for Desktop that you are using, please? You have a tag saying 9.2 but if it is less than 10.1 I think you will have trouble doing this. – PolyGeo Dec 19 '13 at 12:12
• Hiya, yep I am using 9.2... – Lisa SH Dec 19 '13 at 12:49

If you upgrade to ArcGIS 10.1 or 10.2 you should be able to do this using a Python AddIn Extension.

With .lyr, your best option is to use a Python script. Here is an example.

import arcpy.mapping as mmap

mxd = mmap.MapDocument("D:/yourmxd.mxd")
DF = mmap.ListDataFrames(mxd)[0]
sourcely = mmap.Layer("D:\\yourlayer.lyr")
ly = mmap.ListLayers(mxd)[1]
mmap.UpdateLayer(DF, ly, sourcely, False)


Of course, you can loop on the mxds in Python (e.g. using glob.glob) so that you don't need to update each mxd manually.

The "clean" alternative with ArcGIS is to store your data in a geodatabase and to use "representations" for the symbology.

• I think a Python AddIn extension that adds the "base map" lyr file each time a map is created or opened will be the solution but it needs 10.1 or 10.2. – PolyGeo Dec 19 '13 at 12:46
• Thanks PolyGeo, does this mean I wouldn't need to re-run the script each time, so that the symbology would 'auto-update'? If so this would be worth the upgrade for me. – Lisa SH Dec 19 '13 at 12:52
• Thanks radouxju - would the 'representations' method in a geodatabase auto-update? I will have a look into this too! – Lisa SH Dec 19 '13 at 12:53
• For the representation, it would work as you wish. But again, I think that representation are not available with 9.2 – radouxju Dec 19 '13 at 14:25
• if it's there but in grey, it is then a licence issue (you probably need ArcEditor level) – radouxju Dec 19 '13 at 15:11