Add a GPX Line layer (polyline helper)

Learn how to incorporate a GPX line layer into your map by utilizing the polyline layer helper in this illustrative example. To replicate this example, download the GPX run 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: 14.5,
    center: [-77.01801, 38.92368],
    style: MapStyle.DATAVIZ.DARK
});

map.on('load', async function () {
  await helpers.addPolyline(map, {
    data: 'https://docs.maptiler.com/sdk-js/examples/helper-polyline-gpx/run.gpx',
    outline: true
  });
});
Line layer (polyline helper)

Line layer (polyline helper)

Examples

Add minimal 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 dash pattern symbol (polyline helper)

Line dash pattern symbol (polyline helper)

Examples

Add dash pattern 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?