kyanuk1

Retrieving / Setting symbology based on feature layer

Discussion created by kyanuk1 on Aug 26, 2013
Latest reply on Aug 30, 2013 by pavsanto
Hello,

I am working on a small add-in that will retrieve information about feature layers (symbology, definition queries, etc.), which will allow users to import / export these settings between map documents.  I am looking for some guidance in collecting the symbology properties per feature layer.  I have the following code that is hit for each feature layer in a map document:

                var featureLayer = (IFeatureLayer)layer;
                var legendInfo = (ILegendInfo)featureLayer;

                for (int li = 0; li < legendInfo.LegendGroupCount; li++)
                {
                    var legendGroup = legendInfo.get_LegendGroup(li);
                    for (int lg = 0; lg < legendGroup.ClassCount; lg++)
                    {
                        var legendClass = legendGroup.get_Class(lg);
                    }
                }



Is it possible to collect symbology properties (i.e. in an .XML file), to reload into new feature layers in a new MXD?  I was looking at the IFeatureRenderer's as well - is this a better method of obtaining symbology properties?

Any advice / direction is much appreciated!  Thanks

Outcomes