Heatmap layer custom radius (heatmap helper)

This example shows how to add a heatmap layer to the map by utilizing the heatmap layer helper, along with a customized zoom-ramping radius. You can access the sample data by downloading the US schools example data.

The radius, which can be adjusted based on custom properties, is also internally adjusted in conjunction with zoom values.

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: 8.06,
    center: [-89.755, 35.073],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addHeatmap(map, {
    data: 'schools.geojson',
    radius: [
      {zoom: 2, value: 5 },
      {zoom: 5, value: 10 },
      {zoom: 10, value: 15 },
      {zoom: 15, value: 40 },
      {zoom: 20, value: 100 },
    ],
  });
});
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 radius and weight by property (heatmap helper)

Heatmap layer radius and weight by property (heatmap helper)

Examples

Control heatmap radius and weight using data properties.

Point layer cluster (point helper)

Point layer cluster (point helper)

Examples

Add clustered point layer using MapTiler point helper.

Was this helpful?