Add a vector tile source

Enhance your map by incorporating a vector source.

With the help of the MapTiler Engine, you can convert your data into vector tiles effortlessly. These tiles can then be uploaded to the MapTiler with just a simple click, allowing you to seamlessly integrate your data into all of your web mapping applications.

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: 13,
    center: [-122.447303, 37.753574]
});

map.on('load', function () {
    map.addSource('contours', {
        type: 'vector',
        url:
            `https://api.maptiler.com/tiles/contours/tiles.json`
    });
    map.addLayer({
        'id': 'terrain-data',
        'type': 'line',
        'source': 'contours',
        'source-layer': 'contour',
        'layout': {
            'line-join': 'round',
            'line-cap': 'round'
        },
        'paint': {
            'line-color': '#ff69b4',
            'line-width': 1
        }
    });
});
Add a third party vector tile source

Add a third party vector tile source

Examples

Add and render third-party vector data 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?