Point layer outline (point helper)

The following example demonstrates the process of including a point layer on the map along with an outline. This can be achieved by utilizing the point layer helper. To replicate this example, download the earthquake sample data.

In this example, the outline starts at zoom level 7. Additionally, the width and opacity of the outline can be gradually increased to create a visually appealing effect.

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: 7.88,
    center: [151.401, -5.096],
    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),
    minPointRadius: 2,
    maxPointRadius: 100,
    pointOpacity: 0.7,
    showLabel: true,
    labelSize: 10, // 12 by default
    outline: true,
    outlineWidth: [
      {zoom: 6, value: 0},
      {zoom: 7, value: 1},
      {zoom: 12, value: 5},
    ],
    outlineOpacity: [
      {zoom: 7, value: 0},
      {zoom: 10, value: 1},
    ],
    outlineColor: "#000",
    labelColor: "#000"
  });
});
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 colored and sized according to a property (point helper)

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

Examples

Style point layer by property using point helper.

Was this helpful?