heatmapDensity

Gets the kernel density estimation of a pixel in a heatmap layer, which is a relative measure of how many data points are crowded around a particular pixel. Can only be used in the `heatmap-color` property.

Example usage:


HeatmapLayer layer = new HeatmapLayer("layer-id", "source-id");
layer.setProperties(
    heatmapColor(interpolate(linear(), heatmapDensity(),
        literal(0), rgba(33, 102, 172, 0),
        literal(0.2), rgb(103, 169, 207),
        literal(0.4), rgb(209, 229, 240),
        literal(0.6), rgb(253, 219, 199),
        literal(0.8), rgb(239, 138, 98),
        literal(1), rgb(178, 24, 43))
    )
);

Return

expression

See also

<a href="https://maplibre.org/maplibre-style-spec/expressions/#heatmap-density">Style specification</a>