simonescu
simonescu

Reputation: 482

Constant heat map with mapbox

The new mapbox heatmap api looks awesome.

I want to achieve a constant heat map while zooming someone posted on github: https://cloud.githubusercontent.com/assets/186834/26474453/068dbd00-4166-11e7-996d-ec1756eb7355.gif

Looking at the official api example (https://www.mapbox.com/mapbox-gl-js/example/heatmap-layer/), how can I achieve this?

Upvotes: 2

Views: 1654

Answers (1)

Lucas Wojciechowski
Lucas Wojciechowski

Reputation: 3802

I believe the gif you posted is from a development prototype. This "constant heat map" effect is not the intended/default behavior of heat maps in GL.

That said, this behavior can be simulated using expressions! You'll need to use an expression that double heatmap-radius at each zoom level with a base of 2.

{
  "id": "heatmap",
  "type": "heatmap",
  "source": "heatmap-source",
  "paint": {
    "heatmap-radius": {
      "base": 2,
      "stops": [
        [
          10,
          2
        ],
        [
          19,
          512
        ]
      ]
    }
  }
}

Upvotes: 4

Related Questions