ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LasStretchRendererDefinition Class / LasStretchRendererDefinition Constructor / LasStretchRendererDefinition Constructor(LASStretchAttribute,LASStretchType,Double,CIMColorRamp)
The stretch attribute.
The stretch type.
(Optional) The symbol scale factor assigned to the symbols. Valid values are between -4.0 and 4.0.
(Optional) Color ramp to apply to those classes.
Example

In This Topic
    LasStretchRendererDefinition Constructor(LASStretchAttribute,LASStretchType,Double,CIMColorRamp)
    In This Topic
    Creates a LAS stretch renderer.
    Syntax
    Public Function New( _
       ByVal stretchAttribute As LASStretchAttribute, _
       Optional ByVal stretchType As LASStretchType, _
       Optional ByVal symbolScaleFactor As Double, _
       Optional ByVal colorRamp As CIMColorRamp _
    )

    Parameters

    stretchAttribute
    The stretch attribute.
    stretchType
    The stretch type.
    symbolScaleFactor
    (Optional) The symbol scale factor assigned to the symbols. Valid values are between -4.0 and 4.0.
    colorRamp
    (Optional) Color ramp to apply to those classes.
    Remarks
    Only the following values are valid for stretchAttribute - ArcGIS.Core.CIM.LASStretchAttribute.Elevation, ArcGIS.Core.CIM.LASStretchAttribute.Intensity and ArcGIS.Core.CIM.LASStretchAttribute.ScanAngle. The following values are valid for stretchType - ArcGIS.Core.CIM.LASStretchType.DefaultFromSource and ArcGIS.Core.CIM.LASStretchType.MinimumMaximum. ArcGIS.Core.CIM.LASStretchType.StandardDeviations is also valid if your StretchAttribute is Elevation or Intensity.

    The symbol size is calculated as Math.Pow(2, symbolScaleFactor).

    Example
    Create a LasDatasetLayer with renderers
    //Must be on the QueuedTask.Run()
    
    var lasCP_renderers = new LasDatasetLayerCreationParams(lasDataset);
    lasCP_renderers.Name = "My LAS Layer";
    lasCP_renderers.IsVisible = false;
    
    // create a point elevation renderer
    var ptR = new LasStretchRendererDefinition();
    // accept all defaults
    
    // create a simple edge renderer
    var edgeR = new TinEdgeRendererDefintion();
    // accept all defaults
    
    // add renderers to dictionary
    var l_dict = new Dictionary<SurfaceRendererTarget, TinRendererDefinition>();
    l_dict.Add(SurfaceRendererTarget.Points, ptR);
    l_dict.Add(SurfaceRendererTarget.Edges, edgeR);
    
    // assign dictionary to creation params
    lasCP_renderers.RendererDefinitions = l_dict;
    
    //Create the layer to the LAS dataset
    var lasDatasetLayer_rd = LayerFactory.Instance.CreateLayer<LasDatasetLayer>(lasCP_renderers, map);
    
    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);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also