Created
February 11, 2012 23:11
-
Star
(187)
You must be signed in to star a gist -
Fork
(43)
You must be signed in to fork a gist
-
-
Save mourner/1804938 to your computer and use it in GitHub Desktop.
Leaflet shortcuts for common tile providers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cloudmade = new L.TileLayer.CloudMade({key: 'API-KEY', styleId: 997}), | |
openStreetMap = new L.TileLayer.OpenStreetMap(), | |
openCycleMap = new L.TileLayer.OpenCycleMap(), | |
mapquestOsm = new L.TileLayer.MapQuestOpen.OSM(), | |
mapquestAerial = new L.TileLayer.MapQuestOpen.Aerial(), | |
mapbox = new L.TileLayer.MapBox({user: 'kkaefer', map: 'island'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'; | |
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 © <a href="http://cloudmade.com">CloudMade</a>', | |
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 © <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png" />'; | |
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' | |
}); | |
}()); |
joonas-fi - how do you deal with OSM where local languages are displayed on the map?
Has anyone figured out the issue with the local language on openstreetmap?
There are lots of tile servers available based on OSM, you can choose the one that fits your requirement.
Visit : http://leaflet-extras.github.io/leaflet-providers/preview/
There are lots of tile servers available based on OSM, you can choose the one that fits your requirement. Visit : http://leaflet-extras.github.io/leaflet-providers/preview/
Hi
Can you tell me how to add this to a qgis map
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MapQuest just ended support for their open tile service.
I signed up to get an API key, just to find out that now I need to get their Leaflet plugin to use MapQuest:
I just cannot justify adding 26 KB more of JavaScript libraries to my application and adding one more single point of failure FOR NO APPARENT REASON WHATSOEVER (better behaviour: change URL -> change provider).
MapQuest just lost a user. I liked their map colors more (compared to OpenStreetMap), but upon learning about the bad choices they made, I'll revert back to using OpenStreetMap. :)