Line outline glow blur symbol (polyline helper)

This example demonstrates the addition of an outline glow blur symbol to enhance the visual appeal of a line layer. To achieve this, the polyline layer helper is employed. To implement this feature, simply download the NY subway lines 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: 9.5,
    center: [-73.8931, 40.7396],
    style: MapStyle.DATAVIZ.DARK
});

map.on('load', async function () {
  await helpers.addPolyline(map, {
    data: 'YOUR_MAPTILER_DATASET_ID_HERE',
    // --> Main line
    lineColor: "#fff",       // White
    lineOpacity: 0.7,        // Partially transparent to see the halo color through

    // --> Halo line
    outline: true,           // To create the electric halo, the outline is
    outlineColor: "#d83bff", // purple
    outlineOpacity: 0.5,     // half transparent
    outlineWidth: 15,        // quite large compared to the main line
    outlineBlur: 15,         // and blurry
  });
});
Line layer (polyline helper)

Line layer (polyline helper)

Examples

Add minimal line layer using MapTiler polyline helper.

Add a GPX Line layer (polyline helper)

Add a GPX Line layer (polyline helper)

Examples

Add GPX line layer using MapTiler polyline helper.

Line color ramp symbol (polyline helper)

Line color ramp symbol (polyline helper)

Examples

Style line color based on map zoom level.

Show line data from GeoJSON on the map

GeoJSON line layer

Tutorials

Add a GeoJSON line overlay to the map application.

Was this helpful?