PageSourceSearch

https://bobr.by/assets/v367/corelib/leaflet/leaflet-providers.js

js bobr.by collected 2026-10-01 11:44:05 UTC 26,974 bytes, 669 lines download raw bytes

vendor: 6,061 bytes, lines 1-145
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            var forceHTTP = window.location.protocol === 'file:' || provider.options.forceHTTP;
54            if (provider.url.indexOf('//') === 0 && forceHTTP) {
55                provider.url = 'http:' + provider.url;
56            }
57
58            // If retina option is set
59            if (provider.options.retina) {
60                // Check retina screen
61                if (options.detectRetina && L.Browser.retina) {
62                    // The retina option will be active now
63                    // But we need to prevent Leaflet retina mode
64                    options.detectRetina = false;
65                } else {
66                    // No retina, remove option
67                    provider.options.retina = '';
68                }
69            }
70
71            // replace attribution placeholders with their values from toplevel provider attribution,
72            // recursively
73            var attributionReplacer = function (attr) {
74                if (attr.indexOf('{attribution.') === -1) {
75                    return attr;
76                }
77                return attr.replace(/\{attribution.(\w*)\}/,
78                    function (match, attributionName) {
79                        return attributionReplacer(providers[attributionName].options.attribution);
80                    }
81                );
82            };
83            provider.options.attribution = attributionReplacer(provider.options.attribution);
84
85            // Compute final options combining provider options with any user overrides
86            var layerOpts = L.Util.extend({}, provider.options, options);
87            L.TileLayer.prototype.initialize.call(this, provider.url, layerOpts);
88        }
89    });
90
91    /**
92     * Definition of providers.
93     * see http://leafletjs.com/reference.html#tilelayer for options in the options map.
94     */
95
96    L.TileLayer.Provider.providers = {
97        OpenStreetMap: {
98            url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
99            options: {
100                maxZoom: 19,
101                attribution:
102                    '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
103            },
104            variants: {
105                Mapnik: {},
106                BlackAndWhite: {
107                    url: 'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png',
108                    options: {
109                        maxZoom: 18
110                    }
111                },
112                DE: {
113                    url: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
114                    options: {
115                        maxZoom: 18
116                    }
117                },
118                France: {
119                    url: '//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',
120                    options: {
121                        maxZoom: 20,
122                        attribution: '&copy; Openstreetmap France | {attribution.OpenStreetMap}'
123                    }
124                },
125                HOT: {
126                    url: '//{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
127                    options: {
128                        attribution: '{attribution.OpenStreetMap}, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
129                    }
130                }
131            }
132        },
133        OpenSeaMap: {
134            url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
135            options: {
136                attribution: 'Map data: &copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
137            }
138        },
139        OpenTopoMap: {
140            url: '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
141            options: {
142                maxZoom: 17,
143                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>)'
144            }
145        },
146        Thunderforest: {
147            url: '//{s}.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png?apikey={apikey}',
148            options: {
149                attribution:
150                    '&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, {attribution.OpenStreetMap}',
151                variant: 'cycle'
152            },
153            variants: {
154                OpenCycleMap: 'cycle',
155                Transport: {
156                    options: {
157                        variant: 'transport',
158                        maxZoom: 19
159                    }
160                },
161                TransportDark: {
162                    options: {
163                        variant: 'transport-dark',
164                        maxZoom: 19
165                    }
166                },
167                SpinalMap: {
168                    options: {
169                        variant: 'spinal-map',
170                        maxZoom: 11
171                    }
172                },
173                Landscape: 'landscape',
174                Outdoors: 'outdoors',
175                Pioneer: 'pioneer'
176            }
177        },
178        OpenMapSurfer: {
179            url: 'http://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}',
180            options: {
181                maxZoom: 20,
182                variant: 'roads',
183                attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">GIScience Research Group @ University of Heidelberg</a> &mdash; Map data {attribution.OpenStreetMap}'
184            },
185            variants: {
186                Roads: 'roads',
187                AdminBounds: {
188                    options: {
189                        variant: 'adminb',
190                        maxZoom: 19
191                    }
192                },
193                Grayscale: {
194                    options: {
195                        variant: 'roadsg',
196                        maxZoom: 19
197                    }
198                }
199            }
200        },
201        Hydda: {
202            url: '//{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png',
203            options: {
204                variant: 'full',
205                attribution: 'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> &mdash; Map data {attribution.OpenStreetMap}'
206            },
207            variants: {
208                Full: 'full',
209                Base: 'base',
210                RoadsAndLabels: 'roads_and_labels'
211            }
212        },
213        MapBox: {
214            url: '//api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
215            options: {
216                attribution:
217                'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' +
218                'Map data {attribution.OpenStreetMap}',
219                subdomains: 'abcd'
220            }
221        },
222        Stamen: {
223            url: '//stamen-tiles-{s}.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.{ext}',
224            options: {
225                attribution:
226                'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
227                '<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; ' +
228                'Map data {attribution.OpenStreetMap}',
229                subdomains: 'abcd',
230                minZoom: 0,
231                maxZoom: 20,
232                variant: 'toner',
233                ext: 'png'
234            },
235            variants: {
236                Toner: 'toner',
237                TonerBackground: 'toner-background',
238                TonerHybrid: 'toner-hybrid',
239                TonerLines: 'toner-lines',
240                TonerLabels: 'toner-labels',
241                TonerLite: 'toner-lite',
242                Watercolor: {
243                    options: {
244                        variant: 'watercolor',
245                        minZoom: 1,
246                        maxZoom: 16
247                    }
248                },
249                Terrain: {
250                    options: {
251                        variant: 'terrain',
252                        minZoom: 0,
253                        maxZoom: 18
254                    }
255                },
vendor: 13,185 bytes, lines 256-578
256                TerrainBackground: {
257                    options: {
258                        variant: 'terrain-background',
259                        minZoom: 0,
260                        maxZoom: 18
261                    }
262                },
263                TopOSMRelief: {
264                    options: {
265                        variant: 'toposm-color-relief',
266                        ext: 'jpg',
267                        bounds: [[22, -132], [51, -56]]
268                    }
269                },
270                TopOSMFeatures: {
271                    options: {
272                        variant: 'toposm-features',
273                        bounds: [[22, -132], [51, -56]],
274                        opacity: 0.9
275                    }
276                }
277            }
278        },
279        Esri: {
280            url: '//server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{z}/{y}/{x}',
281            options: {
282                variant: 'World_Street_Map',
283                attribution: 'Tiles &copy; Esri'
284            },
285            variants: {
286                WorldStreetMap: {
287                    options: {
288                        attribution:
289                        '{attribution.Esri} &mdash; ' +
290                        'Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
291                    }
292                },
293                DeLorme: {
294                    options: {
295                        variant: 'Specialty/DeLorme_World_Base_Map',
296                        minZoom: 1,
297                        maxZoom: 11,
298                        attribution: '{attribution.Esri} &mdash; Copyright: &copy;2012 DeLorme'
299                    }
300                },
301                WorldTopoMap: {
302                    options: {
303                        variant: 'World_Topo_Map',
304                        attribution:
305                        '{attribution.Esri} &mdash; ' +
306                        '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'
307                    }
308                },
309                WorldImagery: {
310                    options: {
311                        variant: 'World_Imagery',
312                        attribution:
313                        '{attribution.Esri} &mdash; ' +
314                        'Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
315                    }
316                },
317                WorldTerrain: {
318                    options: {
319                        variant: 'World_Terrain_Base',
320                        maxZoom: 13,
321                        attribution:
322                        '{attribution.Esri} &mdash; ' +
323                        'Source: USGS, Esri, TANA, DeLorme, and NPS'
324                    }
325                },
326                WorldShadedRelief: {
327                    options: {
328                        variant: 'World_Shaded_Relief',
329                        maxZoom: 13,
330                        attribution: '{attribution.Esri} &mdash; Source: Esri'
331                    }
332                },
333                WorldPhysical: {
334                    options: {
335                        variant: 'World_Physical_Map',
336                        maxZoom: 8,
337                        attribution: '{attribution.Esri} &mdash; Source: US National Park Service'
338                    }
339                },
340                OceanBasemap: {
341                    options: {
342                        variant: 'Ocean_Basemap',
343                        maxZoom: 13,
344                        attribution: '{attribution.Esri} &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
345                    }
346                },
347                NatGeoWorldMap: {
348                    options: {
349                        variant: 'NatGeo_World_Map',
350                        maxZoom: 16,
351                        attribution: '{attribution.Esri} &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
352                    }
353                },
354                WorldGrayCanvas: {
355                    options: {
356                        variant: 'Canvas/World_Light_Gray_Base',
357                        maxZoom: 16,
358                        attribution: '{attribution.Esri} &mdash; Esri, DeLorme, NAVTEQ'
359                    }
360                }
361            }
362        },
363        OpenWeatherMap: {
364            url: 'http://{s}.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png',
365            options: {
366                maxZoom: 19,
367                attribution: 'Map data &copy; <a href="http://openweathermap.org">OpenWeatherMap</a>',
368                opacity: 0.5
369            },
370            variants: {
371                Clouds: 'clouds',
372                CloudsClassic: 'clouds_cls',
373                Precipitation: 'precipitation',
374                PrecipitationClassic: 'precipitation_cls',
375                Rain: 'rain',
376                RainClassic: 'rain_cls',
377                Pressure: 'pressure',
378                PressureContour: 'pressure_cntr',
379                Wind: 'wind',
380                Temperature: 'temp',
381                Snow: 'snow'
382            }
383        },
384        HERE: {
385            /*
386             * HERE maps, formerly Nokia maps.
387             * These basemaps are free, but you need an API key. Please sign up at
388             * http://developer.here.com/getting-started
389             *
390             * Note that the base urls contain '.cit' whichs is HERE's
391             * 'Customer Integration Testing' environment. Please remove for production
392             * envirionments.
393             */
394            url:
395            '//{s}.{base}.maps.cit.api.here.com/maptile/2.1/' +
396            '{type}/{mapID}/{variant}/{z}/{x}/{y}/{size}/{format}?' +
397            'app_id={app_id}&app_code={app_code}&lg={language}',
398            options: {
399                attribution:
400                    'Map &copy; 1987-2014 <a href="http://developer.here.com">HERE</a>',
401                subdomains: '1234',
402                mapID: 'newest',
403                'app_id': '<insert your app_id here>',
404                'app_code': '<insert your app_code here>',
405                base: 'base',
406                variant: 'normal.day',
407                maxZoom: 20,
408                type: 'maptile',
409                language: 'eng',
410                format: 'png8',
411                size: '256'
412            },
413            variants: {
414                normalDay: 'normal.day',
415                normalDayCustom: 'normal.day.custom',
416                normalDayGrey: 'normal.day.grey',
417                normalDayMobile: 'normal.day.mobile',
418                normalDayGreyMobile: 'normal.day.grey.mobile',
419                normalDayTransit: 'normal.day.transit',
420                normalDayTransitMobile: 'normal.day.transit.mobile',
421                normalNight: 'normal.night',
422                normalNightMobile: 'normal.night.mobile',
423                normalNightGrey: 'normal.night.grey',
424                normalNightGreyMobile: 'normal.night.grey.mobile',
425
426                basicMap: {
427                    options: {
428                        type: 'basetile'
429                    }
430                },
431                mapLabels: {
432                    options: {
433                        type: 'labeltile',
434                        format: 'png'
435                    }
436                },
437                trafficFlow: {
438                    options: {
439                        base: 'traffic',
440                        type: 'flowtile'
441                    }
442                },
443                carnavDayGrey: 'carnav.day.grey',
444                hybridDay: {
445                    options: {
446                        base: 'aerial',
447                        variant: 'hybrid.day'
448                    }
449                },
450                hybridDayMobile: {
451                    options: {
452                        base: 'aerial',
453                        variant: 'hybrid.day.mobile'
454                    }
455                },
456                pedestrianDay: 'pedestrian.day',
457                pedestrianNight: 'pedestrian.night',
458                satelliteDay: {
459                    options: {
460                        base: 'aerial',
461                        variant: 'satellite.day'
462                    }
463                },
464                terrainDay: {
465                    options: {
466                        base: 'aerial',
467                        variant: 'terrain.day'
468                    }
469                },
470                terrainDayMobile: {
471                    options: {
472                        base: 'aerial',
473                        variant: 'terrain.day.mobile'
474                    }
475                }
476            }
477        },
478        FreeMapSK: {
479            url: 'http://t{s}.freemap.sk/T/{z}/{x}/{y}.jpeg',
480            options: {
481                minZoom: 8,
482                maxZoom: 16,
483                subdomains: '1234',
484                bounds: [[47.204642, 15.996093], [49.830896, 22.576904]],
485                attribution:
486                    '{attribution.OpenStreetMap}, vizualization CC-By-SA 2.0 <a href="http://freemap.sk">Freemap.sk</a>'
487            }
488        },
489        MtbMap: {
490            url: 'http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png',
491            options: {
492                attribution:
493                    '{attribution.OpenStreetMap} &amp; USGS'
494            }
495        },
496        CartoDB: {
497            url: 'http://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}.png',
498            options: {
499                attribution: '{attribution.OpenStreetMap} &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
500                subdomains: 'abcd',
501                maxZoom: 19,
502                variant: 'light_all'
503            },
504            variants: {
505                Positron: 'light_all',
506                PositronNoLabels: 'light_nolabels',
507                PositronOnlyLabels: 'light_only_labels',
508                DarkMatter: 'dark_all',
509                DarkMatterNoLabels: 'dark_nolabels',
510                DarkMatterOnlyLabels: 'dark_only_labels'
511            }
512        },
513        HikeBike: {
514            url: 'http://{s}.tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
515            options: {
516                maxZoom: 19,
517                attribution: '{attribution.OpenStreetMap}',
518                variant: 'hikebike'
519            },
520            variants: {
521                HikeBike: {},
522                HillShading: {
523                    options: {
524                        maxZoom: 15,
525                        variant: 'hillshading'
526                    }
527                }
528            }
529        },
530        BasemapAT: {
531            url: 'https://maps{s}.wien.gv.at/basemap/{variant}/normal/google3857/{z}/{y}/{x}.{format}',
532            options: {
533                maxZoom: 19,
534                attribution: 'Datenquelle: <a href="www.basemap.at">basemap.at</a>',
535                subdomains: ['', '1', '2', '3', '4'],
536                format: 'png',
537                bounds: [[46.358770, 8.782379], [49.037872, 17.189532]],
538                variant: 'geolandbasemap'
539            },
540            variants: {
541                basemap: {
542                    options: {
543                        maxZoom: 20, // currently only in Vienna
544                        variant: 'geolandbasemap'
545                    }
546                },
547                grau: 'bmapgrau',
548                overlay: 'bmapoverlay',
549                highdpi: {
550                    options: {
551                        variant: 'bmaphidpi',
552                        format: 'jpeg'
553                    }
554                },
555                orthofoto: {
556                    options: {
557                        maxZoom: 20, // currently only in Vienna
558                        variant: 'bmaporthofoto30cm',
559                        format: 'jpeg'
560                    }
561                }
562            }
563        },
564        NASAGIBS: {
565            url: '//map1.vis.earthdata.nasa.gov/wmts-webmerc/{variant}/default/{time}/{tilematrixset}{maxZoom}/{z}/{y}/{x}.{format}',
566            options: {
567                attribution:
568                'Imagery provided by services from the Global Imagery Browse Services (GIBS), operated by the NASA/GSFC/Earth Science Data and Information System ' +
569                '(<a href="https://earthdata.nasa.gov">ESDIS</a>) with funding provided by NASA/HQ.',
570                bounds: [[-85.0511287776, -179.999999975], [85.0511287776, 179.999999975]],
571                minZoom: 1,
572                maxZoom: 9,
573                format: 'jpg',
574                time: '',
575                tilematrixset: 'GoogleMapsCompatible_Level'
576            },
577            variants: {
578                ModisTerraTrueColorCR: 'MODIS_Terra_CorrectedReflectance_True
578Color',
579                ModisTerraBands367CR: 'MODIS_Terra_CorrectedReflectance_Bands367',
580                ViirsEarthAtNight2012: {
581                    options: {
582                        variant: 'VIIRS_CityLights_2012',
583                        maxZoom: 8
584                    }
585                },
586                ModisTerraLSTDay: {
587                    options: {
588                        variant: 'MODIS_Terra_Land_Surface_Temp_Day',
589                        format: 'png',
590                        maxZoom: 7,
591                        opacity: 0.75
592                    }
593                },
594                ModisTerraSnowCover: {
595                    options: {
596                        variant: 'MODIS_Terra_Snow_Cover',
597                        format: 'png',
598                        maxZoom: 8,
599                        opacity: 0.75
600                    }
601                },
602                ModisTerraAOD: {
603                    options: {
604                        variant: 'MODIS_Terra_Aerosol',
605                        format: 'png',
606                        maxZoom: 6,
607                        opacity: 0.75
608                    }
609                },
610                ModisTerraChlorophyll: {
611                    options: {
612                        variant: 'MODIS_Terra_Chlorophyll_A',
613                        format: 'png',
614                        maxZoom: 7,
615                        opacity: 0.75
616                    }
617                }
618            }
619        },
620        NLS: {
621            // NLS maps are copyright National library of Scotland.
622            // http://maps.nls.uk/projects/api/index.html
623            // Please contact NLS for anything other than non-commercial low volume usage
624            //
625            // Map sources: Ordnance Survey 1:1m to 1:63K, 1920s-1940s
626            //   z0-9  - 1:1m
627            //  z10-11 - quarter inch (1:253440)
628            //  z12-18 - one inch (1:63360)
629            url: '//nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg',
630            options: {
631                attribution: '<a href="http://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
632                bounds: [[49.6, -12], [61.7, 3]],
633                minZoom: 1,
634                maxZoom: 18,
635                subdomains: '0123',
636            }
637        },
638        JusticeMap: {
639            // Justice Map (http://www.justicemap.org/)
640            // Visualize race and income data for your community, county and country.
641            // Includes tools for data journalists, bloggers and community activists.
642            url: 'http://www.justicemap.org/tile/{size}/{variant}/{z}/{x}/{y}.png',
643            options: {
644                attribution: '<a href="http://www.justicemap.org/terms.php">Justice Map</a>',
645                // one of 'county', 'tract', 'block'
646                size: 'county',
647                // Bounds for USA, including Alaska and Hawaii
648                bounds: [[14, -180], [72, -56]]
649            },
650            variants: {
651                income: 'income',
652                americanIndian: 'indian',
653                asian: 'asian',
654                black: 'black',
655                hispanic: 'hispanic',
656                multi: 'multi',
657                nonWhite: 'nonwhite',
658                white: 'white',
659                plurality: 'plural'
660            }
661        }
662    };
663
664    L.tileLayer.provider = function (provider, options) {
665        return new L.TileLayer.Provider(provider, options);
666    };
667
668    return L;
669}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.