Point layer colored and sized according to a property (point helper)

This example illustrates the process of incorporating a point layer into a map, with the color and size of the points determined by the “mag” property, which represents the magnitude of earthquakes. To achieve this, we utilize the point layer helper. To access the sample data necessary for this exercise, please download the earthquake sample data.

In this particular case, we have opted to establish magnitude boundaries ranging between 1 and 5.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config, ColorRampCollection, 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: 4.30,
    center: [-167.99, 52.7],
    style: MapStyle.DATAVIZ.LIGHT
});

map.on('load', async function () {
  await helpers.addPoint(map, {
    data: 'YOUR_MAPTILER_DATASET_ID_HERE',
    property: "mag",
    pointColor: ColorRampCollection.VIRIDIS.scale(1, 5),
  });
});
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?