Line layer (polyline helper)

Learn how to incorporate a line layer into your map by utilizing the polyline layer helper. This example shows how to add a line layer to the map using the polyline layer helper with the default values. To replicate this example, download the Amphitheater Lake trail sample data.

In this instance, the color is randomly selected from a predefined list of colors. This is the default action when no specific color is specified.

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: 14,
    center: [-110.75926, 43.72683],
    style: MapStyle.OUTDOOR
});

map.on('load', async function () {
  await helpers.addPolyline(map, {
    data: 'YOUR_MAPTILER_DATASET_ID_HERE',
    outline: true,
  });
});
Style a GeoJSON Line layer (polyline helper)

Style a GeoJSON Line layer (polyline helper)

Examples

Style GeoJSON line layer using MapTiler polyline helper.

Add a KML Line layer (polyline helper)

Add a KML Line layer (polyline helper)

Examples

Add KML line layer using MapTiler polyline helper.

Line outline glow blur symbol (polyline helper)

Line outline glow blur symbol (polyline helper)

Examples

Add glowing outline to line layer using helper.

Show line data from GeoJSON on the map

GeoJSON line layer

Tutorials

Add a GeoJSON line overlay to the map application.

Was this helpful?