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 var forceHTTP
= window
.location
.protocol
=== 'file:' || provider
.options
.forceHTTP
;
45 if (provider
.url
.indexOf('//') === 0 && forceHTTP
) {
46 provider
.url
= 'http:' + provider
.url
;
49 // replace attribution placeholders with their values from toplevel provider attribution,
51 var attributionReplacer = function (attr
) {
52 if (attr
.indexOf('{attribution.') === -1) {
55 return attr
.replace(/\{attribution.(\w*)\}/,
56 function (match
, attributionName
) {
57 return attributionReplacer(providers
[attributionName
].options
.attribution
);
61 provider
.options
.attribution
= attributionReplacer(provider
.options
.attribution
);
63 // Compute final options combining provider options with any user overrides
64 var layerOpts
= L
.Util
.extend({}, provider
.options
, options
);
65 L
.TileLayer
.prototype.initialize
.call(this, provider
.url
, layerOpts
);
70 * Definition of providers.
71 * see http://leafletjs.com/reference.html#tilelayer for options in the options map.
74 L
.TileLayer
.Provider
.providers
= {
76 url
: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
79 '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
84 url
: 'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
87 url
: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png'
90 url
: 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
92 attribution
: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
98 url
: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
100 attribution
: 'Map data: © <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
104 url
: '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
107 attribution
: 'Map data: {attribution.OpenStreetMap}, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
111 url
: '//{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png',
114 '© <a href="http://www.opencyclemap.org">OpenCycleMap</a>, {attribution.OpenStreetMap}',
118 OpenCycleMap
: 'cycle',
119 Transport
: 'transport',
120 TransportDark
: 'transport-dark',
121 Landscape
: 'landscape',
126 url
: 'http://openmapsurfer.uni-hd.de/tiles/{variant}/x={x}&y={y}&z={z}',
131 attribution
: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> — Map data {attribution.OpenStreetMap}'
150 url
: 'http://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
155 attribution
: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data {attribution.OpenStreetMap}'
160 RoadsAndLabels
: 'roads_and_labels'
164 /* Mapquest does support https, but with a different subdomain:
165 * https://otile{s}-s.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}
166 * which makes implementing protocol relativity impossible.
168 url
: 'http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}',
173 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
174 'Map data {attribution.OpenStreetMap}',
183 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
184 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
198 return '//{s}.tiles.mapbox.com/v3/' + id
+ '/{z}/{x}/{y}.png';
202 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — ' +
203 'Map data {attribution.OpenStreetMap}',
208 url
: 'http://{s}.tile.stamen.com/{variant}/{z}/{x}/{y}.{ext}',
211 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
212 '<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' +
213 'Map data {attribution.OpenStreetMap}',
222 TonerBackground
: 'toner-background',
223 TonerHybrid
: 'toner-hybrid',
224 TonerLines
: 'toner-lines',
225 TonerLabels
: 'toner-labels',
226 TonerLite
: 'toner-lite',
229 variant
: 'watercolor',
239 bounds
: [[22, -132], [70, -56]]
244 variant
: 'terrain-background',
247 bounds
: [[22, -132], [70, -56]]
252 variant
: 'toposm-color-relief',
254 bounds
: [[22, -132], [51, -56]]
259 variant
: 'toposm-features',
260 bounds
: [[22, -132], [51, -56]],
267 url
: '//server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
269 variant
: 'World_Street_Map',
270 attribution
: 'Tiles © Esri'
276 '{attribution.Esri} — ' +
277 'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
282 variant
: 'Specialty/DeLorme_World_Base_Map',
285 attribution
: '{attribution.Esri} — Copyright: ©2012 DeLorme'
290 variant
: 'World_Topo_Map',
292 '{attribution.Esri} — ' +
293 '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'
298 variant
: 'World_Imagery',
300 '{attribution.Esri} — ' +
301 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
306 variant
: 'World_Terrain_Base',
309 '{attribution.Esri} — ' +
310 'Source: USGS, Esri, TANA, DeLorme, and NPS'
315 variant
: 'World_Shaded_Relief',
317 attribution
: '{attribution.Esri} — Source: Esri'
322 variant
: 'World_Physical_Map',
324 attribution
: '{attribution.Esri} — Source: US National Park Service'
329 variant
: 'Ocean_Basemap',
331 attribution
: '{attribution.Esri} — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
336 variant
: 'NatGeo_World_Map',
338 attribution
: '{attribution.Esri} — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
343 variant
: 'Canvas/World_Light_Gray_Base',
345 attribution
: '{attribution.Esri} — Esri, DeLorme, NAVTEQ'
351 url
: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
353 attribution
: 'Map data © <a href="http://openweathermap.org">OpenWeatherMap</a>',
358 CloudsClassic
: 'clouds_cls',
359 Precipitation
: 'precipitation',
360 PrecipitationClassic
: 'precipitation_cls',
362 RainClassic
: 'rain_cls',
363 Pressure
: 'pressure',
364 PressureContour
: 'pressure_cntr',
372 * HERE maps, formerly Nokia maps.
373 * These basemaps are free, but you need an API key. Please sign up at
374 * http://developer.here.com/getting-started
376 * Note that the base urls contain '.cit' whichs is HERE's
377 * 'Customer Integration Testing' environment. Please remove for production
381 '//{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
382 'maptile/{mapID}/{variant}/{z}/{x}/{y}/256/png8?' +
383 'app_id={app_id}&app_code={app_code}',
386 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>',
389 'app_id': '<insert your app_id here>',
390 'app_code': '<insert your app_code here>',
392 variant
: 'normal.day',
397 normalDay
: 'normal.day',
398 normalDayCustom
: 'normal.day.custom',
399 normalDayGrey
: 'normal.day.grey',
400 normalDayMobile
: 'normal.day.mobile',
401 normalDayGreyMobile
: 'normal.day.grey.mobile',
402 normalDayTransit
: 'normal.day.transit',
403 normalDayTransitMobile
: 'normal.day.transit.mobile',
404 normalNight
: 'normal.night',
405 normalNightMobile
: 'normal.night.mobile',
406 normalNightGrey
: 'normal.night.grey',
407 normalNightGreyMobile
: 'normal.night.grey.mobile',
409 carnavDayGrey
: 'carnav.day.grey',
413 variant
: 'hybrid.day'
419 variant
: 'hybrid.day.mobile'
422 pedestrianDay
: 'pedestrian.day',
423 pedestrianNight
: 'pedestrian.night',
427 variant
: 'satellite.day'
433 variant
: 'terrain.day'
439 variant
: 'terrain.day.mobile'
445 url
: 'http://a{s}.acetate.geoiq.com/tiles/{variant}/{z}/{x}/{y}.png',
448 '©2012 Esri & Stamen, Data from OSM and Natural Earth',
452 variant
: 'acetate-base'
455 basemap
: 'acetate-base',
457 all
: 'acetate-hillshading',
458 foreground
: 'acetate-fg',
459 roads
: 'acetate-roads',
460 labels
: 'acetate-labels',
461 hillshading
: 'hillshading'
465 url
: 'http://{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
469 subdomains
: ['t1', 't2', 't3', 't4'],
471 '{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
475 url
: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
478 '{attribution.OpenStreetMap} & USGS'
482 url
: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
484 attribution
: '{attribution.OpenStreetMap} © <a href="http://cartodb.com/attributions">CartoDB</a>',
491 Positron
: 'light_all',
492 PositronNoLabels
: 'light_nolabels',
493 DarkMatter
: 'dark_all',
494 DarkMatterNoLabels
: 'dark_nolabels'
498 url
: 'http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png',
500 attribution
: '{attribution.OpenStreetMap}'
504 url
: '//maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
506 attribution
: 'Datenquelle: <a href="www.basemap.at">basemap.at</a>',
507 subdomains
: ['', '1', '2', '3', '4'],
508 bounds
: [[46.358770, 8.782379], [49.037872, 17.189532]]
513 variant
: 'geolandbasemap',
519 variant
: 'bmaphidpi',
531 variant
: 'bmapoverlay',
537 variant
: 'bmaporthofoto30cm',
544 url
: '//map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
547 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
548 '(<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.',
549 bounds
: [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]],
554 tilematrixset
: 'GoogleMapsCompatible_Level'
557 ModisTerraTrueColorCR
: 'MODIS_Terra_CorrectedReflectance_TrueColor',
558 ModisTerraBands367CR
: 'MODIS_Terra_CorrectedReflectance_Bands367',
559 ViirsEarthAtNight2012
: {
561 variant
: 'VIIRS_CityLights_2012',
567 variant
: 'MODIS_Terra_Land_Surface_Temp_Day',
573 ModisTerraSnowCover
: {
575 variant
: 'MODIS_Terra_Snow_Cover',
583 variant
: 'MODIS_Terra_Aerosol',
589 ModisTerraChlorophyll
: {
591 variant
: 'MODIS_Terra_Chlorophyll_A',
601 L
.tileLayer
.provider = function (provider
, options
) {
602 return new L
.TileLayer
.Provider(provider
, options
);