<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8' />
        <title>With Autocomplete API</title>
        <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
        <script src='https://tiles.locationiq.com/v2/libs/maplibre-gl/1.15.2/maplibre-gl.js'></script>
        <link href='https://tiles.locationiq.com/v2/libs/maplibre-gl/1.15.2/maplibre-gl.css' rel='stylesheet' />

        <!-- Include the geocoder control -->
        <script src="https://tiles.locationiq.com/v2/libs/gl-geocoder/4.5.1/locationiq-gl-geocoder.min.js?v=0.2.3"></script>
        <link rel="stylesheet" href="https://tiles.locationiq.com/v2/libs/gl-geocoder/4.5.1/locationiq-gl-geocoder.css?v=0.2.3" type="text/css" />

        <!-- Promise polyfill script required to use Mapbox GL Geocoder in IE 11 -->
        <script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js"></script>
        
        <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!)
            locationiqKey = 'pk.a5c3fbf2119bfb2275b62eddbccd76b3';
            //Define the map and configure the map's theme
            var map = new mapboxgl.Map({
                container: 'map',
                attributionControl: false, //need this to show a compact attribution icon (i) instead of the whole text
                style: 'https://tiles.locationiq.com/v2/streets/vector.json?key='+locationiqKey,
                zoom: 12,
                center: [-122.42, 37.779]
            });
            
            //Add Geocoder control to the map
            map.addControl(new MapboxGeocoder({
                accessToken: locationiqKey,
                mapboxgl: mapboxgl,
                limit: 5,
                dedupe: 1,
                marker: {
                    color: 'red'
                },
                flyTo: {
                    screenSpeed: 7,
                    speed: 4
                }
            }), 'top-left');


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