Add a third party vector tile source

To enrich your map, you have the option to incorporate a third-party vector data source into the map.

In this particular example, we are rendering vector data provided by Mapillary.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
    container: 'map',
    style: MapStyle.STREETS, 
    zoom: 12,
    center: [-87.622088, 41.878781]
});

map.on('load', function () {
    // Add Mapillary sequence layer.
    // https://www.mapillary.com/developer/tiles-documentation/#sequence-layer
    map.addSource('mapillary', {
        'type': 'vector',
        'tiles': [
            'https://tiles.mapillary.com/maps/vtp/mly1_public/2/{z}/{x}/{y}?access_token=YOUR_MAPILLARY_TOKEN'
        ],
        'minzoom': 6,
        'maxzoom': 14
    });
    map.addLayer(
        {
            'id': 'mapillary',
            'type': 'line',
            'source': 'mapillary',
            'source-layer': 'sequence',
            'layout': {
                'line-cap': 'round',
                'line-join': 'round'
            },
            'paint': {
                'line-opacity': 0.6,
                'line-color': 'rgb(53, 175, 109)',
                'line-width': 2
            }
        },
        'River labels'
    );
});

map.addControl(new maptilersdk.NavigationControl());
Add a vector tile source

Add a vector tile source

Examples

Add and display custom vector tile sources on maps.

How to display your custom map on the web page.

Custom map

Tutorials

Display your customized MapTiler map on any web page.

Was this helpful?