Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i used next code to load a symbol with specific style.. now i need to do the opposite operation.. i mean, i have one symbol and i want to know it's style.

is it possible?

private ISymbol LoadStyleSymbol()
        IStyleGallery styleGallery = new ServerStyleGalleryClass();
        IStyleGalleryStorage styleStorage = styleGallery as IStyleGalleryStorage;
        styleStorage.TargetFile = @"C:\Program Files\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle";
        styleStorage.AddFile(@"C:\Program Files\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle");
        IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.Items["Marker Symbols", @"C:\Program Files\ArcGIS\Engine10.0\Styles\3D Billboards.ServerStyle", ""];
        IStyleGalleryItem styleItem = enumStyleGalleryItem.Next();

        while (styleItem != null)
            if (styleItem.Name == "Red Pushpin 4") break;
            styleItem = enumStyleGalleryItem.Next();

        ISymbol pSymbol = styleItem.Item as ISymbol;

        return pSymbol;
    catch (Exception ex)
        MessageBox.Show("error 8, " + ex.Message);
        return null;
share|improve this question
Note that Esri suggests using Activator to instantiate the ServerStyleGalleryClass. – Kirk Kuykendall Jun 5 '12 at 21:40

Once you have an ISymbol reference only, you cannot get the style item it came from. Symbols are not linked to the style gallery item.

One way could be to search the style gallery for an item with an equivalent symbol. To compare your symbol and the symbol stored under a gallery item, you could use the IClone.IsEqual method since most symbol classes do implement the IClone interface.

share|improve this answer
thanks petr, but style should be stored some where, or it should be linked to symbol in some manner, because it's used to render symbol later. is it right? – lio Jun 7 '12 at 20:10
Style items are linked to symbols, but the opposite is not true. Symbols are simply not linked back to styles. – Petr Krebs Jun 7 '12 at 21:22
You can do a simple check: Choose a predefined symbol from a style gallery via the Symbol Selector window (e.g. when editing a layer's symbology). Let's say you pick the "Expressway" symbol from the "Esri" style. Now, when you later reopen the symbol selector, you'll see that the "Expressway" item is no longer selected - it served merely as a source for the particular symbol. – Petr Krebs Jun 7 '12 at 21:26
Needless to say, you will also not find any link from symbols back to the style gallery in the ArcObjects model. It's not there. The only way is to do a search for an identical symbol through the gallery, as described in the post. – Petr Krebs Jun 7 '12 at 21:27
sorry to be not so clear, I'm using OpenGL to draw elements with some effects in a Custom Graphics Layer, with a large number of elements i faced a lack of performance.. i'm trying to classify symbols by their style, so i can generate one opengl list per symbol style.. am i on the right way? – lio Jun 7 '12 at 22:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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