Example of a XYZ source.

The XYZ source is used for tile data that is accessed through URLs that include a zoom level and tile grid x/y coordinates.

<!DOCTYPE html>
    <link rel="stylesheet" href="" type="text/css">
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src=",Element.prototype.classList,URL"></script>

    <div id="map" class="map"></div>
      import Map from 'ol/Map.js';
      import View from 'ol/View.js';
      import TileLayer from 'ol/layer/Tile.js';
      import XYZ from 'ol/source/XYZ.js';

      var map = new Map({
        target: 'map',
        layers: [
          new TileLayer({
            source: new XYZ({
              url: 'https://{a-c}{z}/{x}/{y}.png' +
                  '?apikey=Your API key from here'
        view: new View({
          center: [-472202, 7530279],
          zoom: 12