UNPKG

35.9 kBJavaScriptView Raw
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'));
8 } else {
9 // Assume Leaflet is loaded into global object L already
10 factory(L);
11 }
12}(this, function (L) {
13 'use strict';
14
15 L.TileLayer.Provider = L.TileLayer.extend({
16 initialize: function (arg, options) {
17 var providers = L.TileLayer.Provider.providers;
18
19 var parts = arg.split('.');
20
21 var providerName = parts[0];
22 var variantName = parts[1];
23
24 if (!providers[providerName]) {
25 throw 'No such provider (' + providerName + ')';
26 }
27
28 var provider = {
29 url: providers[providerName].url,
30 options: providers[providerName].options
31 };
32
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 + ')';
37 }
38 var variant = providers[providerName].variants[variantName];
39 var variantOptions;
40 if (typeof variant === 'string') {
41 variantOptions = {
42 variant: variant
43 };
44 } else {
45 variantOptions = variant.options;
46 }
47 provider = {
48 url: variant.url || provider.url,
49 options: L.Util.extend({}, provider.options, variantOptions)
50 };
51 }
52
53 // replace attribution placeholders with their values from toplevel provider attribution,
54 // recursively
55 var attributionReplacer = function (attr) {
56 if (attr.indexOf('{attribution.') === -1) {
57 return attr;
58 }
59 return attr.replace(/\{attribution.(\w*)\}/g,
60 function (match, attributionName) {
61 return attributionReplacer(providers[attributionName].options.attribution);
62 }
63 );
64 };
65 provider.options.attribution = attributionReplacer(provider.options.attribution);
66
67 // Compute final options combining provider options with any user overrides
68 var layerOpts = L.Util.extend({}, provider.options, options);
69 L.TileLayer.prototype.initialize.call(this, provider.url, layerOpts);
70 }
71 });
72
73 /**
74 * Definition of providers.
75 * see http://leafletjs.com/reference.html#tilelayer for options in the options map.
76 */
77
78 L.TileLayer.Provider.providers = {
79 OpenStreetMap: {
80 url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
81 options: {
82 maxZoom: 19,
83 attribution:
84 '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
85 },
86 variants: {
87 Mapnik: {},
88 DE: {
89 url: 'https://tile.openstreetmap.de/{z}/{x}/{y}.png',
90 options: {
91 maxZoom: 18
92 }
93 },
94 CH: {
95 url: 'https://tile.osm.ch/switzerland/{z}/{x}/{y}.png',
96 options: {
97 maxZoom: 18,
98 bounds: [[45, 5], [48, 11]]
99 }
100 },
101 France: {
102 url: 'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
103 options: {
104 maxZoom: 20,
105 attribution: '&copy; OpenStreetMap France | {attribution.OpenStreetMap}'
106 }
107 },
108 HOT: {
109 url: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
110 options: {
111 attribution:
112 '{attribution.OpenStreetMap}, ' +
113 'Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> ' +
114 'hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
115 }
116 },
117 BZH: {
118 url: 'https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png',
119 options: {
120 attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://www.openstreetmap.bzh/" target="_blank">Breton OpenStreetMap Team</a>',
121 bounds: [[46.2, -5.5], [50, 0.7]]
122 }
123 }
124 }
125 },
126 MapTilesAPI: {
127 url: 'https://maptiles.p.rapidapi.com/{variant}/{z}/{x}/{y}.png?rapidapi-key={apikey}',
128 options: {
129 attribution:
130 '&copy; <a href="http://www.maptilesapi.com/">MapTiles API</a>, {attribution.OpenStreetMap}',
131 variant: 'en/map/v1',
132 // Get your own MapTiles API access token here : https://www.maptilesapi.com/
133 // NB : this is a demonstration key that comes with no guarantee and not to be used in production
134 apikey: '<insert your api key here>',
135 maxZoom: 19
136 },
137 variants: {
138 OSMEnglish: {
139 options: {
140 variant: 'en/map/v1'
141 }
142 },
143 OSMFrancais: {
144 options: {
145 variant: 'fr/map/v1'
146 }
147 },
148 OSMEspagnol: {
149 options: {
150 variant: 'es/map/v1'
151 }
152 }
153 }
154 },
155 OpenSeaMap: {
156 url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
157 options: {
158 attribution: 'Map data: &copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
159 }
160 },
161 OPNVKarte: {
162 url: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
163 options: {
164 maxZoom: 18,
165 attribution: 'Map <a href="https://memomaps.de/">memomaps.de</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, map data {attribution.OpenStreetMap}'
166 }
167 },
168 OpenTopoMap: {
169 url: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
170 options: {
171 maxZoom: 17,
172 attribution: 'Map data: {attribution.OpenStreetMap}, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
173 }
174 },
175 OpenRailwayMap: {
176 url: 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png',
177 options: {
178 maxZoom: 19,
179 attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
180 }
181 },
182 OpenFireMap: {
183 url: 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png',
184 options: {
185 maxZoom: 19,
186 attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="http://www.openfiremap.org">OpenFireMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
187 }
188 },
189 SafeCast: {
190 url: 'https://s3.amazonaws.com/te512.safecast.org/{z}/{x}/{y}.png',
191 options: {
192 maxZoom: 16,
193 attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://blog.safecast.org/about/">SafeCast</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
194 }
195 },
196 Stadia: {
197 url: 'https://tiles.stadiamaps.com/tiles/{variant}/{z}/{x}/{y}{r}.{ext}',
198 options: {
199 minZoom: 0,
200 maxZoom: 20,
201 attribution:
202 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
203 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
204 '{attribution.OpenStreetMap}',
205 variant: 'alidade_smooth',
206 ext: 'png'
207 },
208 variants: {
209 AlidadeSmooth: 'alidade_smooth',
210 AlidadeSmoothDark: 'alidade_smooth_dark',
211 OSMBright: 'osm_bright',
212 Outdoors: 'outdoors',
213 StamenToner: {
214 options: {
215 attribution:
216 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
217 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
218 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
219 '{attribution.OpenStreetMap}',
220 variant: 'stamen_toner'
221 }
222 },
223 StamenTonerBackground: {
224 options: {
225 attribution:
226 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
227 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
228 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
229 '{attribution.OpenStreetMap}',
230 variant: 'stamen_toner_background'
231 }
232 },
233 StamenTonerLines: {
234 options: {
235 attribution:
236 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
237 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
238 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
239 '{attribution.OpenStreetMap}',
240 variant: 'stamen_toner_lines'
241 }
242 },
243 StamenTonerLabels: {
244 options: {
245 attribution:
246 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
247 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
248 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
249 '{attribution.OpenStreetMap}',
250 variant: 'stamen_toner_labels'
251 }
252 },
253 StamenTonerLite: {
254 options: {
255 attribution:
256 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
257 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
258 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
259 '{attribution.OpenStreetMap}',
260 variant: 'stamen_toner_lite'
261 }
262 },
263 StamenWatercolor: {
264 url: 'https://tiles.stadiamaps.com/tiles/{variant}/{z}/{x}/{y}.{ext}',
265 options: {
266 attribution:
267 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
268 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
269 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
270 '{attribution.OpenStreetMap}',
271 variant: 'stamen_watercolor',
272 ext: 'jpg',
273 minZoom: 1,
274 maxZoom: 16
275 }
276 },
277 StamenTerrain: {
278 options: {
279 attribution:
280 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
281 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
282 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
283 '{attribution.OpenStreetMap}',
284 variant: 'stamen_terrain',
285 minZoom: 0,
286 maxZoom: 18
287 }
288 },
289 StamenTerrainBackground: {
290 options: {
291 attribution:
292 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
293 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
294 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
295 '{attribution.OpenStreetMap}',
296 variant: 'stamen_terrain_background',
297 minZoom: 0,
298 maxZoom: 18
299 }
300 },
301 StamenTerrainLabels: {
302 options: {
303 attribution:
304 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
305 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
306 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
307 '{attribution.OpenStreetMap}',
308 variant: 'stamen_terrain_labels',
309 minZoom: 0,
310 maxZoom: 18
311 }
312 },
313 StamenTerrainLines: {
314 options: {
315 attribution:
316 '&copy; <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> ' +
317 '&copy; <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> ' +
318 '&copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> ' +
319 '{attribution.OpenStreetMap}',
320 variant: 'stamen_terrain_lines',
321 minZoom: 0,
322 maxZoom: 18
323 }
324 }
325 }
326 },
327 Thunderforest: {
328 url: 'https://{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
329 options: {
330 attribution:
331 '&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
332 variant: 'cycle',
333 apikey: '<insert your api key here>',
334 maxZoom: 22
335 },
336 variants: {
337 OpenCycleMap: 'cycle',
338 Transport: {
339 options: {
340 variant: 'transport'
341 }
342 },
343 TransportDark: {
344 options: {
345 variant: 'transport-dark'
346 }
347 },
348 SpinalMap: {
349 options: {
350 variant: 'spinal-map'
351 }
352 },
353 Landscape: 'landscape',
354 Outdoors: 'outdoors',
355 Pioneer: 'pioneer',
356 MobileAtlas: 'mobile-atlas',
357 Neighbourhood: 'neighbourhood'
358 }
359 },
360 CyclOSM: {
361 url: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
362 options: {
363 maxZoom: 20,
364 attribution: '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: {attribution.OpenStreetMap}'
365 }
366 },
367 Jawg: {
368 url: 'https://{s}.tile.jawg.io/{variant}/{z}/{x}/{y}{r}.png?access-token={accessToken}',
369 options: {
370 attribution:
371 '<a href="http://jawg.io" title="Tiles Courtesy of Jawg Maps" target="_blank">&copy; <b>Jawg</b>Maps</a> ' +
372 '{attribution.OpenStreetMap}',
373 minZoom: 0,
374 maxZoom: 22,
375 subdomains: 'abcd',
376 variant: 'jawg-terrain',
377 // Get your own Jawg access token here : https://www.jawg.io/lab/
378 // NB : this is a demonstration key that comes with no guarantee
379 accessToken: '<insert your access token here>',
380 },
381 variants: {
382 Streets: 'jawg-streets',
383 Terrain: 'jawg-terrain',
384 Sunny: 'jawg-sunny',
385 Dark: 'jawg-dark',
386 Light: 'jawg-light',
387 Matrix: 'jawg-matrix'
388 }
389 },
390 MapBox: {
391 url: 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}{r}?access_token={accessToken}',
392 options: {
393 attribution:
394 '&copy; <a href="https://www.mapbox.com/about/maps/" target="_blank">Mapbox</a> ' +
395 '{attribution.OpenStreetMap} ' +
396 '<a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>',
397 tileSize: 512,
398 maxZoom: 18,
399 zoomOffset: -1,
400 id: 'mapbox/streets-v11',
401 accessToken: '<insert your access token here>',
402 }
403 },
404 MapTiler: {
405 url: 'https://api.maptiler.com/maps/{variant}/{z}/{x}/{y}{r}.{ext}?key={key}',
406 options: {
407 attribution:
408 '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
409 variant: 'streets',
410 ext: 'png',
411 key: '<insert your MapTiler Cloud API key here>',
412 tileSize: 512,
413 zoomOffset: -1,
414 minZoom: 0,
415 maxZoom: 21
416 },
417 variants: {
418 Streets: 'streets',
419 Basic: 'basic',
420 Bright: 'bright',
421 Pastel: 'pastel',
422 Positron: 'positron',
423 Hybrid: {
424 options: {
425 variant: 'hybrid',
426 ext: 'jpg'
427 }
428 },
429 Toner: 'toner',
430 Topo: 'topo',
431 Voyager: 'voyager'
432 }
433 },
434 TomTom: {
435 url: 'https://{s}.api.tomtom.com/map/1/tile/{variant}/{style}/{z}/{x}/{y}.{ext}?key={apikey}',
436 options: {
437 variant: 'basic',
438 maxZoom: 22,
439 attribution:
440 '<a href="https://tomtom.com" target="_blank">&copy; 1992 - ' + new Date().getFullYear() + ' TomTom.</a> ',
441 subdomains: 'abcd',
442 style: 'main',
443 ext: 'png',
444 apikey: '<insert your API key here>',
445 },
446 variants: {
447 Basic: 'basic',
448 Hybrid: 'hybrid',
449 Labels: 'labels'
450 }
451 },
452 Esri: {
453 url: 'https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
454 options: {
455 variant: 'World_Street_Map',
456 attribution: 'Tiles &copy; Esri'
457 },
458 variants: {
459 WorldStreetMap: {
460 options: {
461 attribution:
462 '{attribution.Esri} &mdash; ' +
463 'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
464 }
465 },
466 DeLorme: {
467 options: {
468 variant: 'Specialty/DeLorme_World_Base_Map',
469 minZoom: 1,
470 maxZoom: 11,
471 attribution: '{attribution.Esri} &mdash; Copyright: &copy;2012 DeLorme'
472 }
473 },
474 WorldTopoMap: {
475 options: {
476 variant: 'World_Topo_Map',
477 attribution:
478 '{attribution.Esri} &mdash; ' +
479 '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'
480 }
481 },
482 WorldImagery: {
483 options: {
484 variant: 'World_Imagery',
485 attribution:
486 '{attribution.Esri} &mdash; ' +
487 'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
488 }
489 },
490 WorldTerrain: {
491 options: {
492 variant: 'World_Terrain_Base',
493 maxZoom: 13,
494 attribution:
495 '{attribution.Esri} &mdash; ' +
496 'Source: USGS, Esri, TANA, DeLorme, and NPS'
497 }
498 },
499 WorldShadedRelief: {
500 options: {
501 variant: 'World_Shaded_Relief',
502 maxZoom: 13,
503 attribution: '{attribution.Esri} &mdash; Source: Esri'
504 }
505 },
506 WorldPhysical: {
507 options: {
508 variant: 'World_Physical_Map',
509 maxZoom: 8,
510 attribution: '{attribution.Esri} &mdash; Source: US National Park Service'
511 }
512 },
513 OceanBasemap: {
514 options: {
515 variant: 'Ocean/World_Ocean_Base',
516 maxZoom: 13,
517 attribution: '{attribution.Esri} &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
518 }
519 },
520 NatGeoWorldMap: {
521 options: {
522 variant: 'NatGeo_World_Map',
523 maxZoom: 16,
524 attribution: '{attribution.Esri} &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
525 }
526 },
527 WorldGrayCanvas: {
528 options: {
529 variant: 'Canvas/World_Light_Gray_Base',
530 maxZoom: 16,
531 attribution: '{attribution.Esri} &mdash; Esri, DeLorme, NAVTEQ'
532 }
533 }
534 }
535 },
536 OpenWeatherMap: {
537 url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png?appid={apiKey}',
538 options: {
539 maxZoom: 19,
540 attribution: 'Map data &copy; <a href="http://openweathermap.org">OpenWeatherMap</a>',
541 apiKey: '<insert your api key here>',
542 opacity: 0.5
543 },
544 variants: {
545 Clouds: 'clouds',
546 CloudsClassic: 'clouds_cls',
547 Precipitation: 'precipitation',
548 PrecipitationClassic: 'precipitation_cls',
549 Rain: 'rain',
550 RainClassic: 'rain_cls',
551 Pressure: 'pressure',
552 PressureContour: 'pressure_cntr',
553 Wind: 'wind',
554 Temperature: 'temp',
555 Snow: 'snow'
556 }
557 },
558 HERE: {
559 /*
560 * HERE maps, formerly Nokia maps.
561 * These basemaps are free, but you need an api id and app key. Please sign up at
562 * https://developer.here.com/plans
563 */
564 url:
565 'https://{s}.{base}.maps.api.here.com/maptile/2.1/' +
566 '{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
567 'app_id={app_id}&app_code={app_code}&lg={language}',
568 options: {
569 attribution:
570 'Map &copy; 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
571 subdomains: '1234',
572 mapID: 'newest',
573 'app_id': '<insert your app_id here>',
574 'app_code': '<insert your app_code here>',
575 base: 'base',
576 variant: 'normal.day',
577 maxZoom: 20,
578 type: 'maptile',
579 language: 'eng',
580 format: 'png8',
581 size: '256'
582 },
583 variants: {
584 normalDay: 'normal.day',
585 normalDayCustom: 'normal.day.custom',
586 normalDayGrey: 'normal.day.grey',
587 normalDayMobile: 'normal.day.mobile',
588 normalDayGreyMobile: 'normal.day.grey.mobile',
589 normalDayTransit: 'normal.day.transit',
590 normalDayTransitMobile: 'normal.day.transit.mobile',
591 normalDayTraffic: {
592 options: {
593 variant: 'normal.traffic.day',
594 base: 'traffic',
595 type: 'traffictile'
596 }
597 },
598 normalNight: 'normal.night',
599 normalNightMobile: 'normal.night.mobile',
600 normalNightGrey: 'normal.night.grey',
601 normalNightGreyMobile: 'normal.night.grey.mobile',
602 normalNightTransit: 'normal.night.transit',
603 normalNightTransitMobile: 'normal.night.transit.mobile',
604 reducedDay: 'reduced.day',
605 reducedNight: 'reduced.night',
606 basicMap: {
607 options: {
608 type: 'basetile'
609 }
610 },
611 mapLabels: {
612 options: {
613 type: 'labeltile',
614 format: 'png'
615 }
616 },
617 trafficFlow: {
618 options: {
619 base: 'traffic',
620 type: 'flowtile'
621 }
622 },
623 carnavDayGrey: 'carnav.day.grey',
624 hybridDay: {
625 options: {
626 base: 'aerial',
627 variant: 'hybrid.day'
628 }
629 },
630 hybridDayMobile: {
631 options: {
632 base: 'aerial',
633 variant: 'hybrid.day.mobile'
634 }
635 },
636 hybridDayTransit: {
637 options: {
638 base: 'aerial',
639 variant: 'hybrid.day.transit'
640 }
641 },
642 hybridDayGrey: {
643 options: {
644 base: 'aerial',
645 variant: 'hybrid.grey.day'
646 }
647 },
648 hybridDayTraffic: {
649 options: {
650 variant: 'hybrid.traffic.day',
651 base: 'traffic',
652 type: 'traffictile'
653 }
654 },
655 pedestrianDay: 'pedestrian.day',
656 pedestrianNight: 'pedestrian.night',
657 satelliteDay: {
658 options: {
659 base: 'aerial',
660 variant: 'satellite.day'
661 }
662 },
663 terrainDay: {
664 options: {
665 base: 'aerial',
666 variant: 'terrain.day'
667 }
668 },
669 terrainDayMobile: {
670 options: {
671 base: 'aerial',
672 variant: 'terrain.day.mobile'
673 }
674 }
675 }
676 },
677 HEREv3: {
678 /*
679 * HERE maps API Version 3.
680 * These basemaps are free, but you need an API key. Please sign up at
681 * https://developer.here.com/plans
682 * Version 3 deprecates the app_id and app_code access in favor of apiKey
683 *
684 * Supported access methods as of 2019/12/21:
685 * @see https://developer.here.com/faqs#access-control-1--how-do-you-control-access-to-here-location-services
686 */
687 url:
688 'https://{s}.{base}.maps.ls.hereapi.com/maptile/2.1/' +
689 '{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
690 'apiKey={apiKey}&lg={language}',
691 options: {
692 attribution:
693 'Map &copy; 1987-' + new Date().getFullYear() + ' <a href="http://developer.here.com">HERE</a>',
694 subdomains: '1234',
695 mapID: 'newest',
696 apiKey: '<insert your apiKey here>',
697 base: 'base',
698 variant: 'normal.day',
699 maxZoom: 20,
700 type: 'maptile',
701 language: 'eng',
702 format: 'png8',
703 size: '256'
704 },
705 variants: {
706 normalDay: 'normal.day',
707 normalDayCustom: 'normal.day.custom',
708 normalDayGrey: 'normal.day.grey',
709 normalDayMobile: 'normal.day.mobile',
710 normalDayGreyMobile: 'normal.day.grey.mobile',
711 normalDayTransit: 'normal.day.transit',
712 normalDayTransitMobile: 'normal.day.transit.mobile',
713 normalNight: 'normal.night',
714 normalNightMobile: 'normal.night.mobile',
715 normalNightGrey: 'normal.night.grey',
716 normalNightGreyMobile: 'normal.night.grey.mobile',
717 normalNightTransit: 'normal.night.transit',
718 normalNightTransitMobile: 'normal.night.transit.mobile',
719 reducedDay: 'reduced.day',
720 reducedNight: 'reduced.night',
721 basicMap: {
722 options: {
723 type: 'basetile'
724 }
725 },
726 mapLabels: {
727 options: {
728 type: 'labeltile',
729 format: 'png'
730 }
731 },
732 trafficFlow: {
733 options: {
734 base: 'traffic',
735 type: 'flowtile'
736 }
737 },
738 carnavDayGrey: 'carnav.day.grey',
739 hybridDay: {
740 options: {
741 base: 'aerial',
742 variant: 'hybrid.day'
743 }
744 },
745 hybridDayMobile: {
746 options: {
747 base: 'aerial',
748 variant: 'hybrid.day.mobile'
749 }
750 },
751 hybridDayTransit: {
752 options: {
753 base: 'aerial',
754 variant: 'hybrid.day.transit'
755 }
756 },
757 hybridDayGrey: {
758 options: {
759 base: 'aerial',
760 variant: 'hybrid.grey.day'
761 }
762 },
763 pedestrianDay: 'pedestrian.day',
764 pedestrianNight: 'pedestrian.night',
765 satelliteDay: {
766 options: {
767 base: 'aerial',
768 variant: 'satellite.day'
769 }
770 },
771 terrainDay: {
772 options: {
773 base: 'aerial',
774 variant: 'terrain.day'
775 }
776 },
777 terrainDayMobile: {
778 options: {
779 base: 'aerial',
780 variant: 'terrain.day.mobile'
781 }
782 }
783 }
784 },
785 FreeMapSK: {
786 url: 'https://{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
787 options: {
788 minZoom: 8,
789 maxZoom: 16,
790 subdomains: 'abcd',
791 bounds: [[47.204642, 15.996093], [49.830896, 22.576904]],
792 attribution:
793 '{attribution.OpenStreetMap}, visualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
794 }
795 },
796 MtbMap: {
797 url: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
798 options: {
799 attribution:
800 '{attribution.OpenStreetMap} &amp; USGS'
801 }
802 },
803 CartoDB: {
804 url: 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png',
805 options: {
806 attribution: '{attribution.OpenStreetMap} &copy; <a href="https://carto.com/attributions">CARTO</a>',
807 subdomains: 'abcd',
808 maxZoom: 20,
809 variant: 'light_all'
810 },
811 variants: {
812 Positron: 'light_all',
813 PositronNoLabels: 'light_nolabels',
814 PositronOnlyLabels: 'light_only_labels',
815 DarkMatter: 'dark_all',
816 DarkMatterNoLabels: 'dark_nolabels',
817 DarkMatterOnlyLabels: 'dark_only_labels',
818 Voyager: 'rastertiles/voyager',
819 VoyagerNoLabels: 'rastertiles/voyager_nolabels',
820 VoyagerOnlyLabels: 'rastertiles/voyager_only_labels',
821 VoyagerLabelsUnder: 'rastertiles/voyager_labels_under'
822 }
823 },
824 HikeBike: {
825 url: 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
826 options: {
827 maxZoom: 19,
828 attribution: '{attribution.OpenStreetMap}',
829 variant: 'hikebike'
830 },
831 variants: {
832 HikeBike: {},
833 HillShading: {
834 options: {
835 maxZoom: 15,
836 variant: 'hillshading'
837 }
838 }
839 }
840 },
841 BasemapAT: {
842 url: 'https://mapsneu.wien.gv.at/basemap/{variant}/{type}/google3857/{z}/{y}/{x}.{format}',
843 options: {
844 maxZoom: 19,
845 attribution: 'Datenquelle: <a href="https://www.basemap.at">basemap.at</a>',
846 type: 'normal',
847 format: 'png',
848 bounds: [[46.358770, 8.782379], [49.037872, 17.189532]],
849 variant: 'geolandbasemap'
850 },
851 variants: {
852 basemap: {
853 options: {
854 maxZoom: 20, // currently only in Vienna
855 variant: 'geolandbasemap'
856 }
857 },
858 grau: 'bmapgrau',
859 overlay: 'bmapoverlay',
860 terrain: {
861 options: {
862 variant: 'bmapgelaende',
863 type: 'grau',
864 format: 'jpeg'
865 }
866 },
867 surface: {
868 options: {
869 variant: 'bmapoberflaeche',
870 type: 'grau',
871 format: 'jpeg'
872 }
873 },
874 highdpi: {
875 options: {
876 variant: 'bmaphidpi',
877 format: 'jpeg'
878 }
879 },
880 orthofoto: {
881 options: {
882 maxZoom: 20, // currently only in Vienna
883 variant: 'bmaporthofoto30cm',
884 format: 'jpeg'
885 }
886 }
887 }
888 },
889 nlmaps: {
890 url: 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/{variant}/EPSG:3857/{z}/{x}/{y}.png',
891 options: {
892 minZoom: 6,
893 maxZoom: 19,
894 bounds: [[50.5, 3.25], [54, 7.6]],
895 attribution: 'Kaartgegevens &copy; <a href="https://www.kadaster.nl">Kadaster</a>'
896 },
897 variants: {
898 'standaard': 'standaard',
899 'pastel': 'pastel',
900 'grijs': 'grijs',
901 'water': 'water',
902 'luchtfoto': {
903 'url': 'https://service.pdok.nl/hwh/luchtfotorgb/wmts/v1_0/Actueel_ortho25/EPSG:3857/{z}/{x}/{y}.jpeg',
904 }
905 }
906 },
907 NASAGIBS: {
908 url: 'https://map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
909 options: {
910 attribution:
911 'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
912 '(<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.',
913 bounds: [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]],
914 minZoom: 1,
915 maxZoom: 9,
916 format: 'jpg',
917 time: '',
918 tilematrixset: 'GoogleMapsCompatible_Level'
919 },
920 variants: {
921 ModisTerraTrueColorCR: 'MODIS_Terra_CorrectedReflectance_TrueColor',
922 ModisTerraBands367CR: 'MODIS_Terra_CorrectedReflectance_Bands367',
923 ViirsEarthAtNight2012: {
924 options: {
925 variant: 'VIIRS_CityLights_2012',
926 maxZoom: 8
927 }
928 },
929 ModisTerraLSTDay: {
930 options: {
931 variant: 'MODIS_Terra_Land_Surface_Temp_Day',
932 format: 'png',
933 maxZoom: 7,
934 opacity: 0.75
935 }
936 },
937 ModisTerraSnowCover: {
938 options: {
939 variant: 'MODIS_Terra_NDSI_Snow_Cover',
940 format: 'png',
941 maxZoom: 8,
942 opacity: 0.75
943 }
944 },
945 ModisTerraAOD: {
946 options: {
947 variant: 'MODIS_Terra_Aerosol',
948 format: 'png',
949 maxZoom: 6,
950 opacity: 0.75
951 }
952 },
953 ModisTerraChlorophyll: {
954 options: {
955 variant: 'MODIS_Terra_Chlorophyll_A',
956 format: 'png',
957 maxZoom: 7,
958 opacity: 0.75
959 }
960 }
961 }
962 },
963 NLS: {
964 // NLS maps are copyright National library of Scotland.
965 // http://maps.nls.uk/projects/api/index.html
966 // Please contact NLS for anything other than non-commercial low volume usage
967 //
968 // Map sources: Ordnance Survey 1:1m to 1:63K, 1920s-1940s
969 // z0-9 - 1:1m
970 // z10-11 - quarter inch (1:253440)
971 // z12-18 - one inch (1:63360)
972 url: 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
973 options: {
974 attribution: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
975 bounds: [[49.6, -12], [61.7, 3]],
976 minZoom: 1,
977 maxZoom: 18,
978 subdomains: '0123',
979 }
980 },
981 JusticeMap: {
982 // Justice Map (http://www.justicemap.org/)
983 // Visualize race and income data for your community, county and country.
984 // Includes tools for data journalists, bloggers and community activists.
985 url: 'https://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png',
986 options: {
987 attribution: '<a href="http://www.justicemap.org/terms.php">Justice Map</a>',
988 // one of 'county', 'tract', 'block'
989 size: 'county',
990 // Bounds for USA, including Alaska and Hawaii
991 bounds: [[14, -180], [72, -56]]
992 },
993 variants: {
994 income: 'income',
995 americanIndian: 'indian',
996 asian: 'asian',
997 black: 'black',
998 hispanic: 'hispanic',
999 multi: 'multi',
1000 nonWhite: 'nonwhite',
1001 white: 'white',
1002 plurality: 'plural'
1003 }
1004 },
1005 GeoportailFrance: {
1006 url: 'https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER={variant}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
1007 options: {
1008 attribution: '<a target="_blank" href="https://www.geoportail.gouv.fr/">Geoportail France</a>',
1009 bounds: [[-75, -180], [81, 180]],
1010 minZoom: 2,
1011 maxZoom: 18,
1012 // Get your own geoportail apikey here : http://professionnels.ign.fr/ign/contrats/
1013 // NB : 'choisirgeoportail' is a demonstration key that comes with no guarantee
1014 apikey: 'choisirgeoportail',
1015 format: 'image/png',
1016 style: 'normal',
1017 variant: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2'
1018 },
1019 variants: {
1020 plan: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2',
1021 parcels: {
1022 options: {
1023 variant: 'CADASTRALPARCELS.PARCELLAIRE_EXPRESS',
1024 style: 'PCI vecteur',
1025 maxZoom: 20
1026 }
1027 },
1028 orthos: {
1029 options: {
1030 maxZoom: 19,
1031 format: 'image/jpeg',
1032 variant: 'ORTHOIMAGERY.ORTHOPHOTOS'
1033 }
1034 }
1035 }
1036 },
1037 OneMapSG: {
1038 url: 'https://maps-{s}.onemap.sg/v3/{variant}/{z}/{x}/{y}.png',
1039 options: {
1040 variant: 'Default',
1041 minZoom: 11,
1042 maxZoom: 18,
1043 bounds: [[1.56073, 104.11475], [1.16, 103.502]],
1044 attribution: '<img src="https://docs.onemap.sg/maps/images/oneMap64-01.png" style="height:20px;width:20px;"/> New OneMap | Map data &copy; contributors, <a href="http://SLA.gov.sg">Singapore Land Authority</a>'
1045 },
1046 variants: {
1047 Default: 'Default',
1048 Night: 'Night',
1049 Original: 'Original',
1050 Grey: 'Grey',
1051 LandLot: 'LandLot'
1052 }
1053 },
1054 USGS: {
1055 url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}',
1056 options: {
1057 maxZoom: 20,
1058 attribution: 'Tiles courtesy of the <a href="https://usgs.gov/">U.S. Geological Survey</a>'
1059 },
1060 variants: {
1061 USTopo: {},
1062 USImagery: {
1063 url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}'
1064 },
1065 USImageryTopo: {
1066 url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}'
1067 }
1068 }
1069 },
1070 WaymarkedTrails: {
1071 url: 'https://tile.waymarkedtrails.org/{variant}/{z}/{x}/{y}.png',
1072 options: {
1073 maxZoom: 18,
1074 attribution: 'Map data: {attribution.OpenStreetMap} | Map style: &copy; <a href="https://waymarkedtrails.org">waymarkedtrails.org</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
1075 },
1076 variants: {
1077 hiking: 'hiking',
1078 cycling: 'cycling',
1079 mtb: 'mtb',
1080 slopes: 'slopes',
1081 riding: 'riding',
1082 skating: 'skating'
1083 }
1084 },
1085 OpenAIP: {
1086 url: 'https://{s}.tile.maps.openaip.net/geowebcache/service/tms/1.0.0/openaip_basemap@EPSG%3A900913@png/{z}/{x}/{y}.{ext}',
1087 options: {
1088 attribution: '<a href="https://www.openaip.net/">openAIP Data</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-NC-SA</a>)',
1089 ext: 'png',
1090 minZoom: 4,
1091 maxZoom: 14,
1092 tms: true,
1093 detectRetina: true,
1094 subdomains: '12'
1095 }
1096 },
1097 OpenSnowMap: {
1098 url: 'https://tiles.opensnowmap.org/{variant}/{z}/{x}/{y}.png',
1099 options: {
1100 minZoom: 9,
1101 maxZoom: 18,
1102 attribution: 'Map data: {attribution.OpenStreetMap} & ODbL, &copy; <a href="https://www.opensnowmap.org/iframes/data.html">www.opensnowmap.org</a> <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
1103 },
1104 variants: {
1105 pistes: 'pistes',
1106 }
1107 },
1108 AzureMaps: {
1109 url:
1110 'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
1111 '&tilesetId={variant}&x={x}&y={y}&zoom={z}&language={language}'+
1112 '&subscription-key={subscriptionKey}',
1113 options: {
1114 attribution: 'See https://docs.microsoft.com/en-us/rest/api/maps/render-v2/get-map-tile for details.',
1115 apiVersion: '2.0',
1116 variant: 'microsoft.imagery',
1117 subscriptionKey: '<insert your subscription key here>',
1118 language: 'en-US',
1119 },
1120 variants: {
1121 MicrosoftImagery: 'microsoft.imagery',
1122 MicrosoftBaseDarkGrey: 'microsoft.base.darkgrey',
1123 MicrosoftBaseRoad: 'microsoft.base.road',
1124 MicrosoftBaseHybridRoad: 'microsoft.base.hybrid.road',
1125 MicrosoftTerraMain: 'microsoft.terra.main',
1126 MicrosoftWeatherInfraredMain: {
1127 url:
1128 'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
1129 '&tilesetId={variant}&x={x}&y={y}&zoom={z}'+
1130 '&timeStamp={timeStamp}&language={language}' +
1131 '&subscription-key={subscriptionKey}',
1132 options: {
1133 timeStamp: '2021-05-08T09:03:00Z',
1134 attribution: 'See https://docs.microsoft.com/en-us/rest/api/maps/render-v2/get-map-tile#uri-parameters for details.',
1135 variant: 'microsoft.weather.infrared.main',
1136 },
1137 },
1138 MicrosoftWeatherRadarMain: {
1139 url:
1140 'https://atlas.microsoft.com/map/tile?api-version={apiVersion}'+
1141 '&tilesetId={variant}&x={x}&y={y}&zoom={z}'+
1142 '&timeStamp={timeStamp}&language={language}' +
1143 '&subscription-key={subscriptionKey}',
1144 options: {
1145 timeStamp: '2021-05-08T09:03:00Z',
1146 attribution: 'See https://docs.microsoft.com/en-us/rest/api/maps/render-v2/get-map-tile#uri-parameters for details.',
1147 variant: 'microsoft.weather.radar.main',
1148 },
1149 }
1150 },
1151 },
1152 SwissFederalGeoportal: {
1153 url: 'https://wmts.geo.admin.ch/1.0.0/{variant}/default/current/3857/{z}/{x}/{y}.jpeg',
1154 options: {
1155 attribution: '&copy; <a href="https://www.swisstopo.admin.ch/">swisstopo</a>',
1156 minZoom: 2,
1157 maxZoom: 18,
1158 bounds: [[45.398181, 5.140242], [48.230651, 11.47757]]
1159 },
1160 variants: {
1161 NationalMapColor: 'ch.swisstopo.pixelkarte-farbe',
1162 NationalMapGrey: 'ch.swisstopo.pixelkarte-grau',
1163 SWISSIMAGE: {
1164 options: {
1165 variant: 'ch.swisstopo.swissimage',
1166 maxZoom: 19
1167 }
1168 }
1169 }
1170 }
1171 };
1172
1173 L.tileLayer.provider = function (provider, options) {
1174 return new L.TileLayer.Provider(provider, options);
1175 };
1176
1177 return L;
1178}));