Skip to content

@smartmaps/smartmaps-gl


@smartmaps/smartmaps-gl

Smartmaps with maplibre support

Examples

as type="module" in html page:

<html>
        <head>
            <title>SmartMaps GL JS - ESM Module Demo</title>
            <script type="module" src="/smartmaps-gl.js"></script>
        </head>
        <body>
            <div id="map"></div>

            <script type="module" src="/src/main.ts"></script>
        </body>
</html>

as esm import :

import { Map } from '@smartmaps/smartmaps-gl';

const map = new Map({
        apiKey: '{INSERT_YOUR_API_KEY}',
        container: elementOrSelector,
        center: { lat: 49.02164948779226, lng: 8.439330018049352 },
        zoom: 15,
        maplibreLogo: false
        // channel: 'yellowmap'
        // style: MapStyle.Light,
        // smartmapsLogo: false
    });

map.on('click', (e) => console.log('map clicked', { ...e }));
map.addControl(
        new GeolocateControl({
            positionOptions: { enableHighAccuracy: false },
            trackUserLocation: false,
            showUserLocation: true,
            showAccuracyCircle: true
        })
    );

Classes

Interfaces

Type Aliases

Variables