Add a KML Line layer (polyline helper)

This example shows the process of incorporating a KML line layer into the map by utilizing the polyline layer helper. You can download the KML track sample data for this example.

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: 18,
    center: [2.3101528, 48.7299456],
    style: MapStyle.BASE
});

map.on('load', async function () {
  await helpers.addPolyline(map, {
    data: 'https://docs.maptiler.com/sdk-js/examples/helper-polyline-kml/track.kml',
    outline: true,
    lineColor: '#3A1888'
  });
});
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 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?