Heatmap layer no zoom compensation (heatmap helper)

This example shows how to add a heatmap layer onto a map without adjusting the radius based on the zoom level. To achieve this, we utilize the heatmap layer helper. You can access the sample data by downloading the US schools example data.

By disabling the .zoomCompensation, we ensure that the size of the data points is solely determined by their corresponding property, rather than being influenced by the zoom level.

This heatmap map approach is particularly suitable for visualizations that are either fixed at a certain zoom level or have a limited range of zoom levels.

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: 11.51,
    center: [-81.4158, 28.5213],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addHeatmap(map, {
    data: 'schools.geojson',
    property: "students",
    zoomCompensation: false,
    radius: [
      {propertyValue: 500, value: 20},
      {propertyValue: 6000, value: 200},
    ],
  });
});
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 min and max zoom (heatmap helper)

Heatmap layer min and max zoom (heatmap helper)

Examples

Set minimum and maximum zoom levels for heatmap layers.

Point layer cluster (point helper)

Point layer cluster (point helper)

Examples

Add clustered point layer using MapTiler point helper.

Was this helpful?