// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core? L.TileLayer.Common = L.TileLayer.extend({ initialize: function (options) { L.TileLayer.prototype.initialize.call(this, this.url, options); } }); (function () { var osmAttr = '© OpenStreetMap contributors, CC-BY-SA'; L.TileLayer.CloudMade = L.TileLayer.Common.extend({ url: 'http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', options: { attribution: 'Map data ' + osmAttr + ', Imagery © CloudMade', styleId: 997 } }); L.TileLayer.OpenStreetMap = L.TileLayer.Common.extend({ url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', options: {attribution: osmAttr} }); L.TileLayer.OpenCycleMap = L.TileLayer.Common.extend({ url: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', options: { attribution: '© OpenCycleMap, ' + 'Map data ' + osm } }); var mqTilesAttr = 'Tiles © MapQuest '; L.TileLayer.MapQuestOpen.OSM = L.TileLayer.Common.extend({ url: 'http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png', options: { subdomains: '1234', type: 'osm', attribution: 'Map data ' + L.TileLayer.OSM_ATTR + ', ' + mqTilesAttr } }); L.TileLayer.MapQuestOpen.Aerial = L.TileLayer.MapQuestOpen.OSM.extend({ options: { type: 'sat', attribution: 'Imagery © NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency, ' + mqTilesAttr } }); L.TileLayer.MapBox = L.TileLayer.Common.extend({ url: 'http://{s}.tiles.mapbox.com/v3/{user}.{map}/{z}/{x}/{y}.png' }); }());