Point layer cluster (point helper)

This example showcases how to generate a cluster map using the point layer helper with its default configurations. To replicate this example, download the US schools sample data.

If your map contains a layer with a significant number of points, you have the option to configure clustering, which aids in visually extracting valuable information from your data. This is where a cluster map, also referred to as a bubble map, proves to be beneficial.

When you activate clustering, point features that are a certain distance apart on the screen are grouped into a cluster. The size of the cluster or bubble corresponds to the number of markers it contains. By zooming in closer on your map, you can view the individual points and interact with them.

Cluster maps are an excellent tool for determining the quantity of data points located within a specific region. If you need to measure density, a heat map is also highly effective and can incorporate your numeric values.

By default, the label is displayed, indicating the number of elements contained within each cluster.

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: 3.2,
    center: [-98.84, 38.28],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addPoint(map, {
    data: 'schools.geojson',
    cluster: true,
  });
});
Display HTML clusters with custom properties

HTML clusters with custom properties

Examples

Enhance map clustering using HTML markers and custom expressions.

Point layer (point helper)

Point layer (point helper)

Examples

Add minimal 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 filtering by property

Point filtering by property

Examples

Filter features in real time by property.

Was this helpful?