seannakasone

Create Symbols and set the Renderer with Python

Discussion created by seannakasone on Apr 17, 2013
Latest reply on Apr 18, 2013 by jbarrette-esristaff
Hi, using python is there a way to create symbol objects and set the uniqueValueRenderer with these symbols?

Below is some C# ArcObjects code that creates 2 symbols and sets the renderer object with these 2 symbols and uses them according to an attribute value...  Is there a way to do this with Python?

             SimpleMarkerSymbol manholesym = new SimpleMarkerSymbol();
             manholesym.Size = 20;
             manholesym.Style = esriSimpleMarkerStyle.esriSMSCircle;

             SimpleMarkerSymbol handholesym = new SimpleMarkerSymbol();
             handholesym.Size = 20;
             handholesym.Style = esriSimpleMarkerStyle.esriSMSSquare;

            IUniqueValueRenderer pUniqueValueRenderer = new UniqueValueRendererClass();
            pUniqueValueRenderer.FieldCount = 1;
            pUniqueValueRenderer.set_Field(0, "MANHOLE_TYPE");
            pUniqueValueRenderer.DefaultSymbol = (ISymbol)manholesym;
            pUniqueValueRenderer.UseDefaultSymbol = true;

            pUniqueValueRenderer.AddValue("MANHOLE", "MANHOLE_TYPE", (ISymbol)manholesym);
            pUniqueValueRenderer.set_Label("MANHOLE", "MANHOLE");
            pUniqueValueRenderer.set_Symbol("MANHOLE", (ISymbol)manholesym);

            pUniqueValueRenderer.AddValue("HANDHOLE", "MANHOLE_TYPE", (ISymbol)handholesym);
            pUniqueValueRenderer.set_Label("HANDHOLE", "HANDHOLE");
            pUniqueValueRenderer.set_Symbol("HANDHOLE", (ISymbol)handholesym);

Outcomes