layers.urlTemplate String

The URL template for tile layers. Template variables:

  • x - X coordinate of the tile
  • y - Y coordinate of the tile
  • zoom - zoom level
  • subdomain - Subdomain for this tile. See subdomains

Example - setting URL template for tile layer

<div id="map"></div>
        layers: [{
            type: "tile",
            urlTemplate: "http://#= subdomain zoom #/#= x #/#= y #.png",
            subdomains: ["a", "b", "c"],
            attribution: "&copy; OpenStreetMap"
In this article