I would like to be able to develop a procedure that runs through all layers in the TOC and if the layer (name) exists in a specific folder where I am storing layer files with complex symbology I would like to import the procedure to import the symbology from the layer files. I have a similar procedure for importing stored Label schema so combining the two into a more dynamic solution would save me a lot of time. Thanks


A while back, I wrote some VB code to persist and de-persist renderers in ArcObjects. It's a slightly different spin on your question but I think what you need is there. The code can be found at: http://arcscripts.esri.com/details.asp?dbid=12474

I hope this helps.


  • Thanks Bill. I tried your script and just simply passed the path to the ".lyr" file as a parameter to the LoadRenderer procedure which raises an unspecified automation error. Any ideas? Thanks – Jakub Sisak GeoGraphics Oct 8 '10 at 20:29
  • OK. It does work. When i create an ".agl" file with the SaveRenderer procedure i can successfully load it into a layer. Can i make this work with existing Layer Files? – Jakub Sisak GeoGraphics Oct 8 '10 at 20:38
  • I suppose I should explain the intent of the code. A .lyr file saves the data source information and everything else necessary to recreate an object that implements ILayer. We didn't need that; we just wanted to save the renderer. As a result, it starts lower down in the object hierarchy. – Bill Dollins Oct 9 '10 at 11:00
  • Here's a link to a discussion of handling .lyr files in C#: forums.esri.com/Thread.asp?c=159&f=1705&t=134959#391529 – Bill Dollins Oct 9 '10 at 11:02
  • To open .lyr files, you should just be able to use the LayerFile coClass (edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriCarto/…). With that, you can get at the layer through the ILayerFile.Layer property. You then need to cast it to an appropriate object (IGeoFeatureLayer for example) to get access to the Renderer property. – Bill Dollins Oct 9 '10 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.