bc82990dd72a7150e6b8ed5d2aa1b6e92dbba1eb
1 (function (root
, factory
) {
2 if (typeof define
=== 'function' && define
.amd
) {
3 // AMD. Register as an anonymous module.
4 define(['leaflet'], factory
);
5 } else if (typeof modules
=== 'object' && module
.exports
) {
6 // define a Common JS module that relies on 'leaflet'
7 module
.exports
= factory(require('leaflet'));
9 // Assume Leaflet is loaded into global object L already
12 }(this, function (L
) {
15 L
.TileLayer
.Provider
= L
.TileLayer
.extend({
16 initialize: function (arg
, options
) {
17 var providers
= L
.TileLayer
.Provider
.providers
;
19 var parts
= arg
.split('.');
21 var providerName
= parts
[0];
22 var variantName
= parts
[1];
24 if (!providers
[providerName
]) {
25 throw 'No such provider (' + providerName
+ ')';
29 url
: providers
[providerName
].url
,
30 options
: providers
[providerName
].options
33 // overwrite values in provider from variant.
34 if (variantName
&& 'variants' in providers
[providerName
]) {
35 if (!(variantName
in providers
[providerName
].variants
)) {
36 throw 'No such variant of ' + providerName
+ ' (' + variantName
+ ')';
38 var variant
= providers
[providerName
].variants
[variantName
];
40 if (typeof variant
=== 'string') {
45 variantOptions
= variant
.options
;
48 url
: variant
.url
|| provider
.url
,
49 options
: L
.Util
.extend({}, provider
.options
, variantOptions
)
51 } else if (typeof provider
.url
=== 'function') {
52 provider
.url
= provider
.url(parts
.splice(1, parts
.length
- 1).join('.'));
55 var forceHTTP
= window
.location
.protocol
=== 'file:' || provider
.options
.forceHTTP
;
56 if (provider
.url
.indexOf('//') === 0 && forceHTTP
) {
57 provider
.url
= 'http:' + provider
.url
;
60 // If retina option is set
61 if (provider
.options
.retina
) {
62 // Check retina screen
63 if (options
.detectRetina
&& L
.Browser
.retina
) {
64 // The retina option will be active now
65 // But we need to prevent Leaflet retina mode
66 options
.detectRetina
= false;
68 // No retina, remove option
69 provider
.options
.retina
= '';
73 // replace attribution placeholders with their values from toplevel provider attribution,
75 var attributionReplacer = function (attr
) {
76 if (attr
.indexOf('{attribution.') === -1) {
79 return attr
.replace(/\{attribution.(\w*)\}/,
80 function (match
, attributionName
) {
81 return attributionReplacer(providers
[attributionName
].options
.attribution
);
85 provider
.options
.attribution
= attributionReplacer(provider
.options
.attribution
);
87 // Compute final options combining provider options with any user overrides
88 var layerOpts
= L
.Util
.extend({}, provider
.options
, options
);
89 L
.TileLayer
.prototype.initialize
.call(this, provider
.url
, layerOpts
);
94 * Definition of providers.
95 * see http://leafletjs.com/reference.html#tilelayer for options in the options map.
98 L
.TileLayer
.Provider
.providers
= {
100 url
: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
104 '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
109 url
: 'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',
115 url
: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
121 url
: 'http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
123 attribution
: '© Openstreetmap France | {attribution.OpenStreetMap}'
127 url
: 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
129 attribution
: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
135 url
: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
137 attribution
: 'Map data: © <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
141 url
: '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
144 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>)'
148 url
: '//{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png',
151 '© <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
155 OpenCycleMap
: 'cycle',
158 variant
: 'transport',
164 variant
: 'transport-dark',
170 variant
: 'spinal-map',
174 Landscape
: 'landscape',
175 Outdoors
: 'outdoors',
180 url
: 'http://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}',
184 attribution
: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> — Map data {attribution.OpenStreetMap}'
203 url
: 'http://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
206 attribution
: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data {attribution.OpenStreetMap}'
211 RoadsAndLabels
: 'roads_and_labels'
215 /* Mapquest does support https, but with a different subdomain:
216 * https://otile{s}-s.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}
217 * which makes implementing protocol relativity impossible.
219 url
: 'http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}',
224 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
225 'Map data {attribution.OpenStreetMap}',
234 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — ' +
235 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency'
248 url
: '//api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
251 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — ' +
252 'Map data {attribution.OpenStreetMap}',
257 url
: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
260 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
261 '<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' +
262 'Map data {attribution.OpenStreetMap}',
271 TonerBackground
: 'toner-background',
272 TonerHybrid
: 'toner-hybrid',
273 TonerLines
: 'toner-lines',
274 TonerLabels
: 'toner-labels',
275 TonerLite
: 'toner-lite',
278 variant
: 'watercolor',
288 bounds
: [[22, -132], [70, -56]]
293 variant
: 'terrain-background',
296 bounds
: [[22, -132], [70, -56]]
301 variant
: 'toposm-color-relief',
303 bounds
: [[22, -132], [51, -56]]
308 variant
: 'toposm-features',
309 bounds
: [[22, -132], [51, -56]],
316 url
: '//server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
318 variant
: 'World_Street_Map',
319 attribution
: 'Tiles © Esri'
325 '{attribution.Esri} — ' +
326 'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
331 variant
: 'Specialty/DeLorme_World_Base_Map',
334 attribution
: '{attribution.Esri} — Copyright: ©2012 DeLorme'
339 variant
: 'World_Topo_Map',
341 '{attribution.Esri} — ' +
342 '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'
347 variant
: 'World_Imagery',
349 '{attribution.Esri} — ' +
350 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
355 variant
: 'World_Terrain_Base',
358 '{attribution.Esri} — ' +
359 'Source: USGS, Esri, TANA, DeLorme, and NPS'
364 variant
: 'World_Shaded_Relief',
366 attribution
: '{attribution.Esri} — Source: Esri'
371 variant
: 'World_Physical_Map',
373 attribution
: '{attribution.Esri} — Source: US National Park Service'
378 variant
: 'Ocean_Basemap',
380 attribution
: '{attribution.Esri} — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
385 variant
: 'NatGeo_World_Map',
387 attribution
: '{attribution.Esri} — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
392 variant
: 'Canvas/World_Light_Gray_Base',
394 attribution
: '{attribution.Esri} — Esri, DeLorme, NAVTEQ'
400 url
: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
403 attribution
: 'Map data © <a href="http://openweathermap.org">OpenWeatherMap</a>',
408 CloudsClassic
: 'clouds_cls',
409 Precipitation
: 'precipitation',
410 PrecipitationClassic
: 'precipitation_cls',
412 RainClassic
: 'rain_cls',
413 Pressure
: 'pressure',
414 PressureContour
: 'pressure_cntr',
422 * HERE maps, formerly Nokia maps.
423 * These basemaps are free, but you need an API key. Please sign up at
424 * http://developer.here.com/getting-started
426 * Note that the base urls contain '.cit' whichs is HERE's
427 * 'Customer Integration Testing' environment. Please remove for production
431 '//{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
432 '{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
433 'app_id={app_id}&app_code={app_code}&lg={language}',
436 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>',
439 'app_id': '<insert your app_id here>',
440 'app_code': '<insert your app_code here>',
442 variant
: 'normal.day',
450 normalDay
: 'normal.day',
451 normalDayCustom
: 'normal.day.custom',
452 normalDayGrey
: 'normal.day.grey',
453 normalDayMobile
: 'normal.day.mobile',
454 normalDayGreyMobile
: 'normal.day.grey.mobile',
455 normalDayTransit
: 'normal.day.transit',
456 normalDayTransitMobile
: 'normal.day.transit.mobile',
457 normalNight
: 'normal.night',
458 normalNightMobile
: 'normal.night.mobile',
459 normalNightGrey
: 'normal.night.grey',
460 normalNightGreyMobile
: 'normal.night.grey.mobile',
479 carnavDayGrey
: 'carnav.day.grey',
483 variant
: 'hybrid.day'
489 variant
: 'hybrid.day.mobile'
492 pedestrianDay
: 'pedestrian.day',
493 pedestrianNight
: 'pedestrian.night',
497 variant
: 'satellite.day'
503 variant
: 'terrain.day'
509 variant
: 'terrain.day.mobile'
515 url
: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
520 bounds
: [[47.204642, 15.996093], [49.830896, 22.576904]],
522 '{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
526 url
: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
529 '{attribution.OpenStreetMap} & USGS'
533 url
: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
535 attribution
: '{attribution.OpenStreetMap} © <a href="http://cartodb.com/attributions">CartoDB</a>',
541 Positron
: 'light_all',
542 PositronNoLabels
: 'light_nolabels',
543 PositronOnlyLabels
: 'light_only_labels',
544 DarkMatter
: 'dark_all',
545 DarkMatterNoLabels
: 'dark_nolabels',
546 DarkMatterOnlyLabels
: 'dark_only_labels'
550 url
: 'http://{s}.tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
553 attribution
: '{attribution.OpenStreetMap}',
561 variant
: 'hillshading'
567 url
: '//maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
570 attribution
: 'Datenquelle: <a href="www.basemap.at">basemap.at</a>',
571 subdomains
: ['', '1', '2', '3', '4'],
573 bounds
: [[46.358770, 8.782379], [49.037872, 17.189532]],
574 variant
: 'geolandbasemap'
577 basemap
: 'geolandbasemap',
579 overlay
: 'bmapoverlay',
582 variant
: 'bmaphidpi',
588 variant
: 'bmaporthofoto30cm',
595 url
: '//map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
598 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
599 '(<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.',
600 bounds
: [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]],
605 tilematrixset
: 'GoogleMapsCompatible_Level'
608 ModisTerraTrueColorCR
: 'MODIS_Terra_CorrectedReflectance_TrueColor',
609 ModisTerraBands367CR
: 'MODIS_Terra_CorrectedReflectance_Bands367',
610 ViirsEarthAtNight2012
: {
612 variant
: 'VIIRS_CityLights_2012',
618 variant
: 'MODIS_Terra_Land_Surface_Temp_Day',
624 ModisTerraSnowCover
: {
626 variant
: 'MODIS_Terra_Snow_Cover',
634 variant
: 'MODIS_Terra_Aerosol',
640 ModisTerraChlorophyll
: {
642 variant
: 'MODIS_Terra_Chlorophyll_A',
651 // NLS maps are copyright National library of Scotland.
652 // http://maps.nls.uk/projects/api/index.html
653 // Please contact NLS for anything other than non-commercial low volume usage
655 // Map sources: Ordnance Survey 1:1m to 1:63K, 1920s-1940s
657 // z10-11 - quarter inch (1:253440)
658 // z12-18 - one inch (1:63360)
659 url
: '//nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
661 attribution
: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
662 bounds
: [[49.6, -12], [61.7, 3]],
670 L
.tileLayer
.provider = function (provider
, options
) {
671 return new L
.TileLayer
.Provider(provider
, options
);