ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SurfaceLayer Class / SetRenderer Method
A custom renderer that will be used to draw the surface layer.
A SurfaceRendererTarget indicating the intended usage of the renderer.
Example

In This Topic
    SetRenderer Method (SurfaceLayer)
    In This Topic
    Specifies the surface layer's renderer which determines how the layer draws. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    renderer
    A custom renderer that will be used to draw the surface layer.
    surfaceRendererTarget
    A SurfaceRendererTarget indicating the intended usage of the renderer.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Cannot set renderer for layer.
    Remarks
    Use CanSetRenderer to determine if the renderer is valid for the layer before updating it.
    Use SurfaceLayer.CreateRenderer to create a new renderer.
    Example
    Simple Node Renderer
    // applies to TIN layers only
    
    var nodeRendererDef = new TinNodeRendererDefinition();
    nodeRendererDef.Description = "Nodes";
    nodeRendererDef.Label = "Nodes";
    nodeRendererDef.SymbolTemplate = nodeSymbol.MakeSymbolReference();
    
    var tinLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();
    if (tinLayer == null)
      return;
    
    if (tinLayer.CanCreateRenderer(nodeRendererDef))
    {
      CIMTinRenderer renderer = tinLayer.CreateRenderer(nodeRendererDef);
      if (tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    Elevation Node Renderer - Equal Breaks
    // applies to TIN layers only
    
    var equalBreaksNodeRendererDef = new TinNodeClassBreaksRendererDefinition();
    equalBreaksNodeRendererDef.BreakCount = 7;
    
    if (tinLayer.CanCreateRenderer(equalBreaksNodeRendererDef))
    {
      CIMTinRenderer renderer = tinLayer.CreateRenderer(equalBreaksNodeRendererDef);
      if (tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
        tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);
    }
    
    Elevation Node Renderer - Defined Interval
    // applies to TIN layers only
    
    var defiendIntervalNodeRendererDef = new TinNodeClassBreaksRendererDefinition();
    defiendIntervalNodeRendererDef.ClassificationMethod = ClassificationMethod.DefinedInterval;
    defiendIntervalNodeRendererDef.IntervalSize = 4;
    defiendIntervalNodeRendererDef.SymbolTemplate = nodeSymbol.MakeSymbolReference();
    
    if (tinLayer.CanCreateRenderer(defiendIntervalNodeRendererDef))
    {
      CIMTinRenderer renderer = tinLayer.CreateRenderer(defiendIntervalNodeRendererDef);
      if (tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
        tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);
    }
    Elevation Node Renderer - Standard Deviation
    // applies to TIN layers only
    
    var stdDevNodeRendererDef = new TinNodeClassBreaksRendererDefinition();
    stdDevNodeRendererDef.ClassificationMethod = ClassificationMethod.StandardDeviation;
    stdDevNodeRendererDef.DeviationInterval = StandardDeviationInterval.OneHalf;
    stdDevNodeRendererDef.ColorRamp = ColorFactory.Instance.GetColorRamp("Cyan to Purple");
    
    if (tinLayer.CanCreateRenderer(stdDevNodeRendererDef))
    {
      CIMTinRenderer renderer = tinLayer.CreateRenderer(stdDevNodeRendererDef);
      if (tinLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
        tinLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);
    }
    
    Simple Edge Renderer
    // applies to TIN or LAS dataset layers only
    
    var edgeRendererDef = new TinEdgeRendererDefintion();
    edgeRendererDef.Description = "Edges";
    edgeRendererDef.Label = "Edges";
    edgeRendererDef.SymbolTemplate = lineSymbol.MakeSymbolReference();
    
    if (surfaceLayer.CanCreateRenderer(edgeRendererDef))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(edgeRendererDef);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);
    }
    Edge Type Renderer
    var breaklineRendererDef = new TinBreaklineRendererDefinition();
    // use default symbol for regular edge but specific symbols for hard,soft,outside
    breaklineRendererDef.HardEdgeSymbol = hardEdgeSymbol.MakeSymbolReference();
    breaklineRendererDef.SoftEdgeSymbol = softEdgeSymbol.MakeSymbolReference();
    breaklineRendererDef.OutsideEdgeSymbol = outsideEdgeSymbol.MakeSymbolReference();
    
    if (surfaceLayer.CanCreateRenderer(breaklineRendererDef))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(breaklineRendererDef);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Edges))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Edges);
    }
    Contour Renderer
    var contourDef = new TinContourRendererDefinition();
    
    // now customize with a symbol
    contourDef.Label = "Contours";
    contourDef.SymbolTemplate = contourLineSymbol.MakeSymbolReference();
    contourDef.ContourInterval = 6;
    
    contourDef.IndexLabel = "Index Contours";
    contourDef.IndexSymbolTemplate = indexLineSymbol.MakeSymbolReference();
    contourDef.ContourFactor = 4;
    contourDef.ReferenceHeight = 7;
    
    if (surfaceLayer.CanCreateRenderer(contourDef))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(contourDef);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Contours))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Contours);
    }
    
    Simple Face Renderer
    var simpleFaceRendererDef = new TinFaceRendererDefinition();
    simpleFaceRendererDef.SymbolTemplate = polySymbol.MakeSymbolReference();
    
    if (surfaceLayer.CanCreateRenderer(simpleFaceRendererDef))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(simpleFaceRendererDef);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Surface))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Surface);
    }
    Aspect Face Renderer
    var aspectFaceRendererDef = new TinFaceClassBreaksAspectRendererDefinition();
    aspectFaceRendererDef.SymbolTemplate = polySymbol.MakeSymbolReference();
    // accept default color ramp
    
    if (surfaceLayer.CanCreateRenderer(aspectFaceRendererDef))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(aspectFaceRendererDef);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Surface))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Surface);
    }
    Slope Face Renderer - Equal Interval
    var slopeFaceClassBreaksEqual = new TinFaceClassBreaksRendererDefinition(TerrainDrawCursorType.FaceSlope);
    // accept default breakCount, symbolTemplate, color ramp
    
    if (surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksEqual))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(slopeFaceClassBreaksEqual);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Surface))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Surface);
    }
    Slope Face Renderer - Quantile
    var slopeFaceClassBreaksQuantile = new TinFaceClassBreaksRendererDefinition(TerrainDrawCursorType.FaceSlope);
    slopeFaceClassBreaksQuantile.ClassificationMethod = ClassificationMethod.Quantile;
    // accept default breakCount, symbolTemplate, color ramp
    
    if (surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksQuantile))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(slopeFaceClassBreaksQuantile);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Surface))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Surface);
    }
    Elevation Face Renderer - Equal Interval
    var elevFaceClassBreaksEqual = new TinFaceClassBreaksRendererDefinition();
    // accept default breakCount, symbolTemplate, color ramp
    
    if (surfaceLayer.CanCreateRenderer(slopeFaceClassBreaksEqual))
    {
      CIMTinRenderer renderer = surfaceLayer.CreateRenderer(slopeFaceClassBreaksEqual);
      if (surfaceLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Surface))
        surfaceLayer.SetRenderer(renderer, SurfaceRendererTarget.Surface);
    }
    Dirty Area Renderer
    // applies to Terrain layers only
    
    var dirtyAreaRendererDef = new TerrainDirtyAreaRendererDefinition();
    // accept default labels, symbolTemplate
    
    var terrainLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<TerrainLayer>().FirstOrDefault();
    if (terrainLayer == null)
      return;
    
    if (terrainLayer.CanCreateRenderer(dirtyAreaRendererDef))
    {
      CIMTinRenderer renderer = terrainLayer.CreateRenderer(dirtyAreaRendererDef);
      if (terrainLayer.CanSetRenderer(renderer, SurfaceRendererTarget.DirtyArea))
        terrainLayer.SetRenderer(renderer, SurfaceRendererTarget.DirtyArea);
    }
    Terrain Point Class Breaks Renderer
    // applies to Terrain layers only
    
    var terrainPointClassBreaks = new TerrainPointClassBreaksRendererDefinition();
    // accept defaults
    
    if (terrainLayer.CanCreateRenderer(terrainPointClassBreaks))
    {
      CIMTinRenderer renderer = terrainLayer.CreateRenderer(terrainPointClassBreaks);
      if (terrainLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        terrainLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    LAS Points Classification Unique Value Renderer
    // applies to LAS dataset layers only
    
    var lasPointsClassificationRendererDef = new LasUniqueValueRendererDefinition(LasAttributeType.Classification);
    // accept the defaults for color ramp, symbolTemplate, symbol scale factor
    
    var lasDatasetLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<LasDatasetLayer>().FirstOrDefault();
    if (lasDatasetLayer == null)
      return;
    
    if (lasDatasetLayer.CanCreateRenderer(lasPointsClassificationRendererDef))
    {
      CIMTinRenderer renderer = lasDatasetLayer.CreateRenderer(lasPointsClassificationRendererDef);
      if (lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    LAS Points Returns Unique Value Renderer
    // applies to LAS dataset layers only
    
    var lasPointsReturnsRendererDef = new LasUniqueValueRendererDefinition(LasAttributeType.ReturnNumber);
    lasPointsReturnsRendererDef.ModulateUsingIntensity = true;
    lasPointsReturnsRendererDef.SymbolScaleFactor = 1.0;
    // accept the defaults for color ramp, symbolTemplate
    
    if (lasDatasetLayer.CanCreateRenderer(lasPointsReturnsRendererDef))
    {
      CIMTinRenderer renderer = lasDatasetLayer.CreateRenderer(lasPointsReturnsRendererDef);
      if (lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    LAS Points Elevation Stretch Renderer
    // applies to LAS dataset layers only
    
    var elevLasStretchRendererDef = new LasStretchRendererDefinition(ArcGIS.Core.CIM.LASStretchAttribute.Elevation);
    // accept the defaults for color ramp, etc
    
    if (lasDatasetLayer.CanCreateRenderer(elevLasStretchRendererDef))
    {
      CIMTinRenderer renderer = lasDatasetLayer.CreateRenderer(elevLasStretchRendererDef);
      if (lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    
    
    // OR use a stretch renderer with stretchType standard Deviations
    var elevLasStretchStdDevRendererDef = new LasStretchRendererDefinition(ArcGIS.Core.CIM.LASStretchAttribute.Elevation);
    elevLasStretchStdDevRendererDef.StretchType = LASStretchType.StandardDeviations;
    elevLasStretchStdDevRendererDef.NumberOfStandardDeviations = 2;
    // accept the defaults for color ramp,  etc
    
    if (lasDatasetLayer.CanCreateRenderer(elevLasStretchStdDevRendererDef))
    {
      CIMTinRenderer renderer = lasDatasetLayer.CreateRenderer(elevLasStretchStdDevRendererDef);
      if (lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    LAS Points Classified Elevation Renderer
    // applies to LAS dataset layers only
    
    var lasPointsClassBreaksRendererDef = new LasPointClassBreaksRendererDefinition();
    lasPointsClassBreaksRendererDef.ClassificationMethod = ClassificationMethod.NaturalBreaks;
    lasPointsClassBreaksRendererDef.ModulateUsingIntensity = true;
    // increase the symbol size by a factor
    lasPointsClassBreaksRendererDef.SymbolScaleFactor = 1.0;
    
    if (lasDatasetLayer.CanCreateRenderer(lasPointsClassBreaksRendererDef))
    {
      CIMTinRenderer renderer = lasDatasetLayer.CreateRenderer(lasPointsClassBreaksRendererDef);
      if (lasDatasetLayer.CanSetRenderer(renderer, SurfaceRendererTarget.Points))
        lasDatasetLayer.SetRenderer(renderer, SurfaceRendererTarget.Points);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also