This example demonstrates how to generate a heatmap-like [[StyleSet]] for a GeoJson. To do so,
each Style needs to define its own color shade, and they all need to be staggered on a
specific range of values. Here, the values are brought directly in the data of the GeoJson,
through the properties held in each feature. This GeoJson is a map of Italy, each feature
represents a region, and the properties bear the population density of that region. We can
narrow the whenExpr condition of a Style to a value in a property, by simply writing
propertyName in the condition. The algorithm then reads:
The algorithm loops through a range of values to create the Styles based on a range of
values, hence the variables in use. Externally it is wrapped in a more readable function where we
can simply describe the heatmap desired:
Finally this [[StyleSet]] is assigned to the DataSource:
This example demonstrates how to generate a heatmap-like [[StyleSet]] for a GeoJson. To do so, each Style needs to define its own color shade, and they all need to be staggered on a specific range of values. Here, the values are brought directly in the data of the GeoJson, through the properties held in each feature. This GeoJson is a map of Italy, each feature represents a region, and the properties bear the population density of that region. We can narrow the
when
Expr condition of a Style to a value in a property, by simply writingpropertyName
in the condition. The algorithm then reads:The algorithm loops through a range of values to create the Styles based on a range of values, hence the variables in use. Externally it is wrapped in a more readable function where we can simply describe the heatmap desired:
Finally this [[StyleSet]] is assigned to the DataSource: