<!doctype html>
<html lang="en">
    <head>
        <link rel="stylesheet" href="https://tiles.locationiq.com/v3/libs/openlayers/8.2.0/ol.css" type="text/css">
        <script src="https://tiles.locationiq.com/v3/libs/openlayers/8.2.0/ol.js"></script>
        <style>
            body { margin:0px; padding:0px; }
            #map { position:absolute; top:0px; bottom:0px; width:100%; }
        </style>
        <script src="https://tiles.locationiq.com/v3/libs/olms/12.0.0/olms.js" type="text/javascript"></script>
        <title>Add Controls</title>
    </head>
    <body>
        <div id="map"></div>
        <script type="text/javascript">
            var key = 'pk.aa7f5d0539c5675b7f3429402939d8fa';   //Insert your LocationIQ access token here

            var styleJson = 'https://tiles-staging.locationiq.com/v3/streets/vector.json?key=' + key;

            const map = new ol.Map({
                target: 'map',
                view: new ol.View({
                    center: ol.proj.fromLonLat([-122.42, 37.779]),
                    zoom: 12
                })
            });

            /**** Let's add some controls to the OL map instance ****/
            //Zoom and attribution control are included by default while using OLMS library for vector maps using OpenLayers

            //Fullscreen
            map.addControl(new ol.control.FullScreen());
            //ScaleLine to show the map scale indicator
            map.addControl(new ol.control.ScaleLine());
            //Map rotation control, Shift+Alt to rotate
            map.addControl(new ol.control.Rotate());
            //Set the view for this map
            map.setView(new ol.View({
                center: ol.proj.fromLonLat([-122.42, 37.779]),
                zoom: 12
            }));

            olms.apply(map, styleJson);
        </script>
    </body>
</html>