62f650a0d992514e765f3e1213a8973935c3bef4
4 L
.TileLayer
.Provider
= L
.TileLayer
.extend({
5 initialize: function (arg
, options
) {
6 var providers
= L
.TileLayer
.Provider
.providers
;
8 var parts
= arg
.split('.');
10 var providerName
= parts
[0];
11 var variantName
= parts
[1];
13 if (!providers
[providerName
]) {
14 throw 'No such provider (' + providerName
+ ')';
18 url
: providers
[providerName
].url
,
19 options
: providers
[providerName
].options
22 // overwrite values in provider from variant.
23 if (variantName
&& 'variants' in providers
[providerName
]) {
24 if (!(variantName
in providers
[providerName
].variants
)) {
25 throw 'No such variant of ' + providerName
+ ' (' + variantName
+ ')';
27 var variant
= providers
[providerName
].variants
[variantName
];
29 if (typeof variant
=== 'string') {
34 variantOptions
= variant
.options
;
37 url
: variant
.url
|| provider
.url
,
38 options
: L
.Util
.extend({}, provider
.options
, variantOptions
)
40 } else if (typeof provider
.url
=== 'function') {
41 provider
.url
= provider
.url(parts
.splice(1, parts
.length
- 1).join('.'));
44 // replace attribution placeholders with their values from toplevel provider attribution,
46 var attributionReplacer = function (attr
) {
47 if (attr
.indexOf('{attribution.') === -1) {
50 return attr
.replace(/\{attribution.(\w*)\}/,
51 function (match
, attributionName
) {
52 return attributionReplacer(providers
[attributionName
].options
.attribution
);
56 provider
.options
.attribution
= attributionReplacer(provider
.options
.attribution
);
58 // Compute final options combining provider options with any user overrides
59 var layerOpts
= L
.Util
.extend({}, provider
.options
, options
);
60 L
.TileLayer
.prototype.initialize
.call(this, provider
.url
, layerOpts
);
65 * Definition of providers.
66 * see http://leafletjs.com/reference.html#tilelayer for options in the options map.
70 L
.TileLayer
.Provider
.providers
= {
72 url
: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
75 '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
80 url
: 'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
83 url
: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png'
86 url
: 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
88 attribution
: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
94 url
: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
96 attribution
: 'Map data: © <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
100 url
: 'http://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png',
103 '© <a href="http://www.opencyclemap.org">OpenCycleMap</a>, {attribution.OpenStreetMap}',
107 OpenCycleMap
: 'cycle',
108 Transport
: 'transport',
109 Landscape
: 'landscape',
114 url
: 'http://openmapsurfer.uni-hd.de/tiles/{variant}/x={x}&y={y}&z={z}',
119 attribution
: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> — Map data {attribution.OpenStreetMap}'
138 url
: 'http://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
143 attribution
: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data {attribution.OpenStreetMap}'
148 RoadsAndLabels
: 'roads_and_labels',
152 url
: 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
155 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
156 'Map data {attribution.OpenStreetMap}',
162 url
: 'http://oatile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg',
165 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
166 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
173 return 'http://{s}.tiles.mapbox.com/v3/' + id
+ '/{z}/{x}/{y}.png';
177 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — ' +
178 'Map data {attribution.OpenStreetMap}',
183 url
: 'http://{s}.tile.stamen.com/{variant}/{z}/{x}/{y}.png',
186 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
187 '<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' +
188 'Map data {attribution.OpenStreetMap}',
196 TonerBackground
: 'toner-background',
197 TonerHybrid
: 'toner-hybrid',
198 TonerLines
: 'toner-lines',
199 TonerLabels
: 'toner-labels',
200 TonerLite
: 'toner-lite',
210 variant
: 'terrain-background',
217 variant
: 'watercolor',
225 url
: 'http://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
227 variant
: 'World_Street_Map',
228 attribution
: 'Tiles © Esri'
234 '{attribution.Esri} — ' +
235 'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
240 variant
: 'Specialty/DeLorme_World_Base_Map',
243 attribution
: '{attribution.Esri} — Copyright: ©2012 DeLorme'
248 variant
: 'World_Topo_Map',
250 '{attribution.Esri} — ' +
251 'Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community'
256 variant
: 'World_Imagery',
258 '{attribution.Esri} — ' +
259 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
264 variant
: 'World_Terrain_Base',
267 '{attribution.Esri} — ' +
268 'Source: USGS, Esri, TANA, DeLorme, and NPS'
273 variant
: 'World_Shaded_Relief',
275 attribution
: '{attribution.Esri} — Source: Esri'
280 variant
: 'World_Physical_Map',
282 attribution
: '{attribution.Esri} — Source: US National Park Service'
287 variant
: 'Ocean_Basemap',
289 attribution
: '{attribution.Esri} — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
294 variant
: 'NatGeo_World_Map',
296 attribution
: '{attribution.Esri} — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
301 variant
: 'Canvas/World_Light_Gray_Base',
303 attribution
: '{attribution.Esri} — Esri, DeLorme, NAVTEQ'
309 url
: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
311 attribution
: 'Map data © <a href="http://openweathermap.org">OpenWeatherMap</a>',
316 CloudsClassic
: 'clouds_cls',
317 Precipitation
: 'precipitation',
318 PrecipitationClassic
: 'precipitation_cls',
320 RainClassic
: 'rain_cls',
321 Pressure
: 'pressure',
322 PressureContour
: 'pressure_cntr',
330 * HERE maps, formerly Nokia maps.
331 * These basemaps are free, but you need an API key. Please sign up at
332 * http://developer.here.com/getting-started
334 * Note that the base urls contain '.cit' whichs is HERE's
335 * 'Customer Integration Testing' environment. Please remove for production
339 'http://{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
340 'maptile/{mapID}/{variant}/{z}/{x}/{y}/256/png8?' +
341 'app_id={app_id}&app_code={app_code}',
344 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>',
347 'app_id': '<insert your app_id here>',
348 'app_code': '<insert your app_code here>',
350 variant
: 'normal.day',
355 normalDay
: 'normal.day',
356 normalDayCustom
: 'normal.day.custom',
357 normalDayGrey
: 'normal.day.grey',
358 normalDayMobile
: 'normal.day.mobile',
359 normalDayGreyMobile
: 'normal.day.grey.mobile',
360 normalDayTransit
: 'normal.day.transit',
361 normalDayTransitMobile
: 'normal.day.transit.mobile',
362 normalNight
: 'normal.night',
363 normalNightMobile
: 'normal.night.mobile',
364 normalNightGrey
: 'normal.night.grey',
365 normalNightGreyMobile
: 'normal.night.grey.mobile',
367 carnavDayGrey
: 'carnav.day.grey',
371 variant
: 'hybrid.day'
377 variant
: 'hybrid.day.mobile'
380 pedestrianDay
: 'pedestrian.day',
381 pedestrianNight
: 'pedestrian.night',
385 variant
: 'satellite.day'
391 variant
: 'terrain.day'
397 variant
: 'terrain.day.mobile'
403 url
: 'http://a{s}.acetate.geoiq.com/tiles/{variant}/{z}/{x}/{y}.png',
406 '©2012 Esri & Stamen, Data from OSM and Natural Earth',
410 variant
: 'acetate-base'
413 basemap
: 'acetate-base',
415 all
: 'acetate-hillshading',
416 foreground
: 'acetate-fg',
417 roads
: 'acetate-roads',
418 labels
: 'acetate-labels',
419 hillshading
: 'hillshading'
423 url
: 'http://{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
427 subdomains
: ['t1', 't2', 't3', 't4'],
429 '{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
433 url
: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
436 '{attribution.OpenStreetMap} & USGS'
440 url
: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
442 attribution
: '{attribution.OpenStreetMap} © <a href="http://cartodb.com/attributions">CartoDB</a>',
449 Positron
: 'light_all',
450 PositronNoLabels
: 'light_nolabels',
451 DarkMatter
: 'dark_all',
452 DarkMatterNoLabels
: 'dark_nolabels'
457 L
.tileLayer
.provider = function (provider
, options
) {
458 return new L
.TileLayer
.Provider(provider
, options
);