ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / HeatMapRendererDefinition Class
Members Example

In This Topic
    HeatMapRendererDefinition Class
    In This Topic
    Represents a heat map renderer definition to draw point features as a density surface.
    Object Model
    HeatMapRendererDefinition ClassCIMColorRamp Class
    Syntax
    Public Class HeatMapRendererDefinition 
       Inherits RendererDefinition
    public class HeatMapRendererDefinition : RendererDefinition 
    Remarks

    Once you define a heat map renderer, you can call a FeatureLayer's CreateRenderer and SetRenderer methods to create and assign a renderer to a point feature layer.

    Only applicable for point feature layers.

    Example
    Create a Heatmap Renderer
    {
        string colorBrewerSchemesName = "ArcGIS Colors";
        //Get the style project item that contains the color ramps
        //Refer to the Initialize region for an example of how to get a style item
        //and the color ramp from it.
        //Note: Run within a QueuedTask
        //defining a heatmap renderer that uses values from Population field as the weights
        HeatMapRendererDefinition heatMapDef = new HeatMapRendererDefinition()
        {
            Radius = 20,
            WeightField = "Population",
            ColorRamp = colorRamp,
            RendereringQuality = 8,
            UpperLabel = "High Density",
            LowerLabel = "Low Density"
        };
        CIMHeatMapRenderer heatMapRndr = featureLayer.CreateRenderer(heatMapDef) as CIMHeatMapRenderer;
        featureLayer.SetRenderer(heatMapRndr);
    }
    Heat map renderer
    /// <summary>
    /// Renders a point feature layer using a continuous color gradient to represent density of points.
    /// ![Heat map renderer](https://ArcGIS.github.io/arcgis-pro-sdk/images/Renderers/heat-map.png)
    /// </summary>
    {
      //Check feature layer name
      //Code works with the U.S. Cities feature layer available with the ArcGIS Pro SDK Sample data
      var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(f => f.Name == "U.S. Cities");
      if (featureLayer == null)
      {
        MessageBox.Show("This renderer works with the U.S. Cities feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
      }
      //defining a heatmap renderer that uses values from Population field as the weights
      HeatMapRendererDefinition heatMapDef = new HeatMapRendererDefinition()
      {
        Radius = 20,
        WeightField = "NumericField",
        ColorRamp = colorRamp,
        RendereringQuality = 8,
        UpperLabel = "High Density",
        LowerLabel = "Low Density"
      };
      //Note: Run within QueuedTask
      CIMHeatMapRenderer heatMapRndr = (CIMHeatMapRenderer)featureLayer.CreateRenderer(heatMapDef);
      featureLayer.SetRenderer(heatMapRndr);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Mapping.LayerDrawingDefinition
          ArcGIS.Desktop.Mapping.RendererDefinition
             ArcGIS.Desktop.Mapping.HeatMapRendererDefinition

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also