Skip to content

Instantly share code, notes, and snippets.

@mourner
Created October 27, 2011 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mourner/1319664 to your computer and use it in GitHub Desktop.
Save mourner/1319664 to your computer and use it in GitHub Desktop.
Basic CloudMade tile layer for Leaflet
L.TileLayer.CloudMade = L.TileLayer.extend({
options: {
maxZoom: 18,
attribution: 'Map data &copy; 2011 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery &copy; 2011 <a href="http://cloudmade.com">CloudMade</a>'
},
initialize: function(key, styleId, options) {
var url = 'http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png',
urlParams = {key: key, styleId: styleId || 997};
L.TileLayer.prototype.initialize.call(this, url, options, urlParams);
}
});
@mourner
Copy link
Author

mourner commented Oct 27, 2011

Usage example:

var cloudmade = new L.TileLayer.CloudMade('YOUR-API-KEY', 997);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment