Select to view content in your preferred language

Create Symbols and set the Renderer with Python

319
1
04-17-2013 03:47 PM
SeanNakasone
Emerging Contributor
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);
Tags (2)
0 Kudos
1 Reply
JeffBarrette
Esri Regular Contributor
There is not a way to create symbols using arcpy.

Jeff
0 Kudos