Is your feature request related to a problem?
An implementation of HeatMapLayerPaint is needed.
Describe the solution you'd like
I suggest making it like this:
public class HeatMapLayerPaint
{
/// <summary>
/// Optional number in range [1, ∞). Units in pixels. Defaults to 30. Supports feature-state and interpolate expressions. Transitionable.
/// Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed.
/// </summary>
[JsonPropertyName("heatmap-radius")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(OneOfJsonConverter<double>))]
public OneOf<double, JsonArray>? HeatmapRadius { get; set; }
/// <summary>
/// Optional number in range [0, ∞). Defaults to 1. Supports feature-state and interpolate expressions.
/// A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering
/// </summary>
[JsonPropertyName("heatmap-weight")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(OneOfJsonConverter<double>))]
public OneOf<double, JsonArray>? HeatmapWeight { get; set; }
/// <summary>
/// Optional number in range [0, ∞). Defaults to 1. Supports interpolate expressions. Transitionable.
/// Similar to heatmap-weight but controls the intensity of the heatmap globally.
/// Primarily used for adjusting the heatmap based on zoom level.
/// </summary>
[JsonPropertyName("heatmap-intensity")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(OneOfJsonConverter<double>))]
public OneOf<double, JsonArray>? HeatmapIntensity { get; set; }
/// <summary>
/// Optional color. Defaults to ["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"].
/// Supports interpolate expressions.
/// Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses ["heatmap-density"] as input.
/// </summary>
[JsonPropertyName("heatmap-color")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(OneOfJsonConverter<string>))]
public OneOf<string, JsonArray>? HeatmapColor { get; set; }
/// <summary>
/// Optional number in range [0, 1]. Defaults to 1. Supports interpolate expressions. Transitionable.
/// The global opacity at which the heatmap layer will be drawn.
/// </summary>
[JsonPropertyName("heatmap-opacity")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(OneOfJsonConverter<double>))]
public OneOf<double, JsonArray>? HeatmapOpacity { get; set; }
}
And add an example in Example:
public static HeatMapLayerPaint CreatePaint() => new()
{
HeatmapWeight = OneOf<double, JsonArray>.FromT1(
[
"interpolate",
new JsonArray { "linear" },
new JsonArray { "get", "value" },
0, 0,
593, 0.5,
613, 0.75,
663, 0.9
]),
HeatmapIntensity = OneOf<double, JsonArray>.FromT1(new JsonArray
{
"interpolate",
new JsonArray { "linear" },
new JsonArray { "zoom" }, 0, 1, 12, 3
}),
HeatmapRadius = OneOf<double, JsonArray>.FromT1(new JsonArray
{
"interpolate", new[] { "linear" }, new[] { "zoom" }, 0, 2, 9, 20
}),
HeatmapOpacity = OneOf<double, JsonArray>.FromT1(new JsonArray
{
"interpolate", new[] { "linear" }, new[] { "zoom" }, 7, 1, 18, 0
}),
HeatmapColor = OneOf<string, JsonArray>.FromT1(new JsonArray
{
"interpolate", new[] { "linear" }, new[] { "heatmap-density" },
0, "rgba(0, 0, 0, 0)",
0.5, "rgba(248, 244, 2, 1)",
0.75, "rgba(243, 102, 29, 1)",
0.9, "rgba(236, 12, 12, 1)",
1, "rgba(152, 0, 0, 1)"
})
};
Describe alternatives you've considered
No response
MapLibre JS Reference
No response
Example Usage
Additional context
No response
Contribution
Is your feature request related to a problem?
An implementation of HeatMapLayerPaint is needed.
Describe the solution you'd like
I suggest making it like this:
And add an example in Example:
Describe alternatives you've considered
No response
MapLibre JS Reference
No response
Example Usage
Additional context
No response
Contribution