XYZ

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>
<html>
  <head>
    <title>XYZ</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.16.0/css/ol.css" type="text/css">
    <script src="http://openlayers.org/en/v3.16.0/build/ol.js"></script>
  </head>
  <body>
    <div id="map" class="map"></div>
    <script>
      var map = new ol.Map({
        target: 'map',
        layers: [
          new ol.layer.Tile({
            source: new ol.source.XYZ({
              url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
            })
          })
        ],
        view: new ol.View({
          center: [-472202, 7530279],
          zoom: 12
        })
      });
    </script>
  </body>
</html>