Scale point radius based on the zoom level (point helper)

This example shows the method of adjusting the size of a point layer based on the zoom level of the map using the point layer helper. By utilizing this technique, you can easily scale the radius of the point layer by the zoom level. To replicate this example, download the earthquake sample data.

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: 6.30,
    center: [-119.602, 35.732],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addPoint(map, {
    data: 'YOUR_MAPTILER_DATASET_ID_HERE',
    pointRadius: [
      {zoom: 2, value: 1 },
      {zoom: 8, value: 6 },
      {zoom: 12, value: 10 },
    ],
    pointColor: "red",
  });
});
Point layer cluster (point helper)

Point layer cluster (point helper)

Examples

Add clustered point layer using MapTiler point helper.

Heatmap layer (heatmap helper)

Heatmap layer (heatmap helper)

Examples

Quickly add a heatmap layer using the heatmap helper.

Point layer (point helper)

Point layer (point helper)

Examples

Add minimal point layer using MapTiler point helper.

Point layer scaled radius by property (point helper)

Point layer scaled radius by property (point helper)

Examples

Scale point layer radius and color by property.

Was this helpful?