Heatmap layer min and max zoom (heatmap helper)

In this example, we will illustrate the process of configuring the minimum and maximum zoom levels for a heatmap layer. To achieve this, we will utilize the heatmap layer helper. You can access the earthquake sample data required for this exercise.

When setting the maximum zoom level, the heatmap will gradually appear (fade-in), starting at -.25z after reaching the minimum zoom level. Similarly, as the maximum zoom level is approached, the heatmap will gradually fade-out by 0.25z.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config, helpers } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
    container: 'map',
    zoom: 7.92,
    center: [-118.609, 37.54],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addHeatmap(map, {
    data: 'YOUR_MAPTILER_DATASET_ID_HERE',
    minzoom: 6,
    maxzoom: 8,
  });
});
Heatmap layer (heatmap helper)

Heatmap layer (heatmap helper)

Examples

Quickly add a heatmap layer using the heatmap helper.

Create a heatmap layer

Create a heatmap layer

Examples

Visualize point data frequency using a custom heatmap layer.

Heatmap layer opacity (heatmap helper)

Heatmap layer opacity (heatmap helper)

Examples

Customize the opacity of your heatmap layer visualization.

Point layer cluster (point helper)

Point layer cluster (point helper)

Examples

Add clustered point layer using MapTiler point helper.

Was this helpful?