<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8' />
        <title>Raster Tiles</title>
        <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
        
        <script src='https://tiles.locationiq.com/v3/libs/maplibre-gl/1.15.2/maplibre-gl.js'></script>
        <link href='https://tiles.locationiq.com/v3/libs/maplibre-gl/1.15.2/maplibre-gl.css' rel='stylesheet' />
        
        <script src='https://tiles.locationiq.com/v3/js/liq-styles-ctrl-libre-gl.js?v=0.1.8'></script>
        <link href='https://tiles.locationiq.com/v3/css/liq-styles-ctrl-libre-gl.css?v=0.1.8' rel="stylesheet" />
        <style>
            body { margin:0px; padding:0px; }
            #map { position:absolute; top:0px; bottom:0px; width:100%; }
        </style>
    </head>
    
    <body>
        <div id='map'></div>
        <script>
            
            //Add your LocationIQ Maps Access Token here (not the API token!)
            locationiq.key = 'pk.aa7f5d0539c5675b7f3429402939d8fa';
            //Define the map and configure the map's theme
            var map = new maplibregl.Map({
                container: 'map',
                style: locationiq.getLayer("Streets"),
                zoom: 12,
                center: [-122.42, 37.779]
            });
                        
            //Define layers you want to add to the layer controls; the first element will be the default layer
            var layerStyles = {
                "Streets": "streets/raster",
                "Dark": "dark/raster",
                "Light": "light/raster",
            };

            map.addControl(new locationiqLayerControl({
                key: locationiq.key,
                layerStyles: layerStyles
            }), 'top-left');

            //Add Navigation controls to the map to the top-right corner of the map
            var nav = new maplibregl.NavigationControl();
            map.addControl(nav, 'top-right');


            //Add a 'full screen' button to the map
            map.addControl(new maplibregl.FullscreenControl());
            
            //Add a Scale to the map
            map.addControl(new maplibregl.ScaleControl({
                maxWidth: 80,
                unit: 'metric' //imperial for miles
            }));

            //Add Geolocation control to the map (will only render when page is opened over HTTPS)
            map.addControl(new maplibregl.GeolocateControl({
                positionOptions: {
                    enableHighAccuracy: true
                },
                trackUserLocation: true
            }));

        </script>
    </body>
</html>