highcharts
Version:
JavaScript charting framework
13 lines • 16.2 kB
JavaScript
!/**
* Highcharts JS v13.0.1 (2026-08-17)
* @module highcharts/modules/tiledwebmap
* @requires highcharts
*
* (c) 2009-2026
*
* A commercial license may be required depending on use,
* see www.highcharts.com/license
*/function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.Fx,e._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/tiledwebmap",["highcharts/highcharts"],function(e){return t(e,e.Fx,e.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/tiledwebmap"]=t(e._Highcharts,e._Highcharts.Fx,e._Highcharts.SeriesRegistry):e.Highcharts=t(e.Highcharts,e.Highcharts.Fx,e.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(e,t,o)=>(()=>{"use strict";var r={168(e){e.exports=t},512(e){e.exports=o},944(t){t.exports=e}};let i={};function a(e){let t=i[e];if(void 0!==t)return t.exports;let o=i[e]={exports:{}};return r[e](o,o.exports,a),o.exports}a.n=e=>{let t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var r=t[o++],i=t[o++];a.o(e,r)?0===i&&o++:0===i?Object.defineProperty(e,r,{enumerable:!0,value:t[o++]}):Object.defineProperty(e,r,{enumerable:!0,get:i})}else for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let s={};a.d(s,{default:()=>M});var n=a(944),p=a.n(n);let l={Esri:class{constructor(){this.defaultCredits="Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012",this.initialProjectionName="WebMercator",this.themes={WorldStreetMap:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20},DeLorme:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/{z}/{y}/{x}",minZoom:1,maxZoom:11,credits:"Tiles © Esri — Copyright: ©2012 DeLorme"},WorldTopoMap:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20,credits:"Tiles © Esri — 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"},WorldImagery:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20,credits:"Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"},WorldTerrain:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:13,credits:"Tiles © Esri — Source: USGS, Esri, TANA, DeLorme, and NPS"},WorldShadedRelief:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:13,credits:"Tiles © Esri — Source: Esri"},WorldPhysical:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:8,credits:"Tiles © Esri — Source: US National Park Service"},NatGeoWorldMap:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:16,credits:"Tiles © Esri — National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC"},WorldGrayCanvas:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:16,credits:"Tiles © Esri — Esri, DeLorme, NAVTEQ"},WorldDarkGrayCanvas:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:16,credits:"Tiles © Esri — Esri, DeLorme, NAVTEQ"}}}},LimaLabs:class{constructor(){this.defaultCredits='Map data ©2023 <a href="https://maps.lima-labs.com/">LimaLabs</a>',this.initialProjectionName="WebMercator",this.requiresApiKey=!0,this.themes={Standard:{url:"https://cdn.lima-labs.com/{zoom}/{x}/{y}.png?api={apikey}",minZoom:0,maxZoom:20}}}},OpenStreetMap:class{constructor(){this.defaultCredits='Map data ©2023 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',this.initialProjectionName="WebMercator",this.subdomains=["a","b","c"],this.themes={Standard:{url:"https://tile.openstreetmap.org/{zoom}/{x}/{y}.png",minZoom:0,maxZoom:19},Hot:{url:"https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",minZoom:0,maxZoom:19},OpenTopoMap:{url:"https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",minZoom:0,maxZoom:17,credits:`Map data: © <a href="https://www.openstreetmap.org/copyright">
OpenStreetMap</a> contributors, <a href="https://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>)`}}}},Stamen:class{constructor(){this.defaultCredits='© Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://www.openstreetmap.org/copyright">ODbL</a>',this.initialProjectionName="WebMercator",this.subdomains=["a","b","c","d"],this.themes={Toner:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",minZoom:0,maxZoom:20},TonerBackground:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/toner-background/{z}/{x}/{y}.png",minZoom:0,maxZoom:20},TonerLite:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.png",minZoom:0,maxZoom:20},Terrain:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png",minZoom:0,maxZoom:18},TerrainBackground:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}.png",minZoom:0,maxZoom:18},Watercolor:{url:"https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png",minZoom:1,maxZoom:16,credits:'© Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'}}}},Thunderforest:class{constructor(){this.defaultCredits='Maps © <a href="https://www.thunderforest.com">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>',this.initialProjectionName="WebMercator",this.requiresApiKey=!0,this.subdomains=["a","b","c"],this.themes={OpenCycleMap:{url:"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},Transport:{url:"https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},TransportDark:{url:"https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},SpinalMap:{url:"https://{s}.tile.thunderforest.com/spinal-map/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},Landscape:{url:"https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},Outdoors:{url:"https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},Pioneer:{url:"https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},MobileAtlas:{url:"https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22},Neighbourhood:{url:"https://{s}.tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png?apikey={apikey}",minZoom:0,maxZoom:22}}}},USGS:class{constructor(){this.defaultCredits='Tiles courtesy of the <a href="https://usgs.gov/">U.S. GeologicalSurvey</a>',this.initialProjectionName="WebMercator",this.themes={USTopo:{url:"https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20},USImagery:{url:"https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20},USImageryTopo:{url:"https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/tile/{z}/{y}/{x}",minZoom:0,maxZoom:20}}}}};var m=a(168),h=a.n(m),c=a(512),d=a.n(c);let{composed:y}=p(),{map:u}=d().seriesTypes;function g(e){let{geoBounds:t,chart:o}=e,r=(o.options.series||[]).filter(e=>"tiledwebmap"===e.type)[0];if(r&&r.provider&&r.provider.type&&!r.provider.url){let e=l[r.provider.type];if((0,n.defined)(e)){let{initialProjectionName:o}=new e;if(t){let{x1:e,y1:r,x2:i,y2:a}=t;this.recommendedMapView={projection:{name:o,parallels:[r,a],rotation:[-(e+i)/2]}}}else this.recommendedMapView={projection:{name:o},minZoom:0};return!1}(0,n.error)("Highcharts warning: Tiles Provider not defined in the Provider Registry.",!1)}return!0}class f extends u{constructor(){super(...arguments),this.redrawTiles=!1,this.isAnimating=!1}static compose(e){(0,n.pushUnique)(y,"TiledWebMapSeries")&&(0,n.addEvent)(e,"onRecommendMapView",g)}lonLatToTile(e,t){let{lon:o,lat:r}=e;return{x:Math.floor((o+180)/360*Math.pow(2,t)),y:Math.floor((1-Math.log(Math.tan(r*Math.PI/180)+1/Math.cos(r*Math.PI/180))/Math.PI)/2*Math.pow(2,t))}}tileToLonLat(e,t,o){let r=e/Math.pow(2,o)*360-180,i=Math.PI-2*Math.PI*t/Math.pow(2,o);return{lon:r,lat:180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)))}}drawPoints(){let e=this.chart,t=e.mapView;if(!t)return;let o=this.tiles=this.tiles||{},r=this.transformGroups=this.transformGroups||[],i=this,a=this.options.provider,{zoom:s}=t,p=(0,n.pick)(t.projection.options.rotation&&t.projection.options.rotation[0],0),m=200*!e.renderer.forExport,c=e=>{for(let r of Object.keys(o))parseFloat(r)===(t.zoom<0?0:Math.floor(t.zoom))||i.minZoom&&(t.zoom<0?0:Math.floor(t.zoom))<i.minZoom&&parseFloat(r)===i.minZoom||i.maxZoom&&(t.zoom<0?0:Math.floor(t.zoom))>i.maxZoom&&parseFloat(r)===i.maxZoom?Object.keys(o[r].tiles).forEach((t,i)=>{o[r].tiles[t].animate({opacity:1},{duration:e},()=>{i===Object.keys(o[r].tiles).length-1&&(o[r].isActive=!0)})}):Object.keys(o[r].tiles).forEach((t,i)=>{o[r].tiles[t].animate({opacity:0},{duration:e,defer:e/2},()=>{o[r].tiles[t].destroy(),delete o[r].tiles[t],i===Object.keys(o[r].tiles).length-1&&(o[r].isActive=!1,o[r].loaded=!1)})})},d=s<0?0:Math.floor(s),y=Math.pow(2,d),u=.638436911716859*Math.pow(2,s)/(.638436911716859*Math.pow(2,d)),g=256*u;if(a&&(a.type||a.url)){if(a.type&&!a.url){let o=l[a.type];if(!(0,n.defined)(o))return void(0,n.error)("Highcharts warning: Tiles Provider '"+a.type+"' not defined in the ProviderRegistry.",!1);let r=new o,i=r.initialProjectionName,s,p="";if(a.theme&&(0,n.defined)(r.themes[a.theme]))s=r.themes[a.theme];else{let e=Object.keys(r.themes)[0];s=r.themes[e],(0,n.error)("Highcharts warning: The Tiles Provider's Theme '"+a.theme+"' is not defined in the Provider definition - falling back to '"+e+"'.",!1)}a.subdomain&&r.subdomains&&-1!==r.subdomains.indexOf(a.subdomain)?p=a.subdomain:(0,n.defined)(r.subdomains)&&-1!==s.url.indexOf("{s}")&&(p=(0,n.pick)(r.subdomains&&r.subdomains[0],""),(0,n.error)("Highcharts warning: The Tiles Provider's Subdomain '"+a.subdomain+"' is not defined in the Provider definition - falling back to '"+p+"'.",!1)),r.requiresApiKey&&(a.apiKey?s.url=s.url.replace("{apikey}",a.apiKey):((0,n.error)("Highcharts warning: The Tiles Provider requires API Key to use tiles, use provider.apiKey to provide a token.",!1),s.url=s.url.replace("?apikey={apikey}",""))),a.url=s.url.replace("{s}",p),this.minZoom=s.minZoom,this.maxZoom=s.maxZoom;let m=(0,n.pick)(e.userOptions.credits&&e.userOptions.credits.text,"Highcharts.com "+(0,n.pick)(s.credits,r.defaultCredits));e.credits?e.credits.update({text:m}):e.addCredits({text:m,style:(0,n.pick)(e.options.credits?.style,{})}),t.projection.options.name!==i&&(0,n.error)("Highcharts warning: The set projection is different than supported by Tiles Provider.",!1)}else t.projection.options.name||(0,n.error)("Highcharts warning: The set projection is different than supported by Tiles Provider.",!1);if((0,n.defined)(this.minZoom)&&d<this.minZoom?(y=Math.pow(2,d=this.minZoom),g=256*(u=.638436911716859*Math.pow(2,s)/(.638436911716859*Math.pow(2,d)))):(0,n.defined)(this.maxZoom)&&d>this.maxZoom&&(y=Math.pow(2,d=this.maxZoom),g=256*(u=.638436911716859*Math.pow(2,s)/(.638436911716859*Math.pow(2,d)))),t.projection&&t.projection.def){t.projection.hasCoordinates=!0,r[d]||(r[d]=e.renderer.g().add(this.group));let s=(s,n,p,l,h)=>{let d=s%y,u=n%y,f=d<0?d+y:d,x=u<0?u+y:u;if(!o[`${p}`].tiles[`${s},${n}`]&&a.url){let d,y=(d=a.url,d.replace("{x}",f.toString()).replace("{y}",x.toString()).replace("{zoom}",p.toString()).replace("{z}",p.toString()));o[p].loaded=!1,o[`${p}`].tiles[`${s},${n}`]=e.renderer.image(y,s*g-l,n*g-h,g,g).attr({zIndex:2,opacity:0}).on("load",function(){a.onload&&a.onload.apply(this),(p===(t.zoom<0?0:Math.floor(t.zoom))||p===i.minZoom)&&(o[`${p}`].actualTilesCount++,o[`${p}`].howManyTiles===o[`${p}`].actualTilesCount&&(o[p].loaded=!0,i.isAnimating?i.redrawTiles=!0:(i.redrawTiles=!1,c(m)),o[`${p}`].actualTilesCount=0))}).add(r[p]),o[`${p}`].tiles[`${s},${n}`].posX=s,o[`${p}`].tiles[`${s},${n}`].posY=n,o[`${p}`].tiles[`${s},${n}`].originalURL=y}},n=t.pixelsToProjectedUnits({x:0,y:0}),l=t.projection.def.inverse([n.x,n.y]),h={lon:l[0]-p,lat:l[1]},u=t.pixelsToProjectedUnits({x:e.plotWidth,y:e.plotHeight}),f=t.projection.def.inverse([u.x,u.y]),x={lon:f[0]-p,lat:f[1]};(h.lat>t.projection.maxLatitude||x.lat<-1*t.projection.maxLatitude)&&(h.lat=t.projection.maxLatitude,x.lat=-1*t.projection.maxLatitude);let M=this.lonLatToTile(h,d),S=this.lonLatToTile(x,d),T=this.tileToLonLat(M.x,M.y,d),v=t.projection.def.forward([T.lon+p,T.lat]),b=t.projectedUnitsToPixels({x:v[0],y:v[1]}),Z=M.x*g-b.x,w=M.y*g-b.y;o[`${d}`]||(o[`${d}`]={tiles:{},isActive:!1,howManyTiles:0,actualTilesCount:0,loaded:!1}),o[`${d}`].howManyTiles=(S.x-M.x+1)*(S.y-M.y+1),o[`${d}`].actualTilesCount=0;for(let e=M.x;e<=S.x;e++)for(let t=M.y;t<=S.y;t++)s(e,t,d,Z,w)}for(let r of Object.keys(o))for(let a of Object.keys(o[r].tiles))if(t.projection&&t.projection.def){let l=o[r].tiles[a];h().timers.length>0&&(0,n.stop)(l,"animator");let y=256*(.638436911716859*Math.pow(2,s)/(.638436911716859*Math.pow(2,parseFloat(r)))),u=o[r].tiles[Object.keys(o[r].tiles)[0]],{posX:g,posY:f}=l;if((0,n.defined)(g)&&(0,n.defined)(f)&&(0,n.defined)(u.posX)&&(0,n.defined)(u.posY)){let a=this.tileToLonLat(u.posX,u.posY,parseFloat(r)),s=t.projection.def.forward([a.lon+p,a.lat]),n=t.projectedUnitsToPixels({x:s[0],y:s[1]}),h=u.posX*y-n.x,x=u.posY*y-n.y;if(e.renderer.globalAnimation&&e.hasRendered){let e=Number(l.attr("x")),t=Number(l.attr("y")),o=Number(l.attr("width")),r=Number(l.attr("height")),a=(i,a)=>{l.attr({x:e+(g*y-h-e)*a.pos,y:t+(f*y-x-t)*a.pos,width:o+(Math.ceil(y)+1-o)*a.pos,height:r+(Math.ceil(y)+1-r)*a.pos})};i.isAnimating=!0,l.attr({animator:0}).animate({animator:1},{step:a},function(){i.isAnimating=!1,i.redrawTiles&&(i.redrawTiles=!1,c(m))})}else(i.redrawTiles||parseFloat(r)!==d||(o[r].isActive||parseFloat(r)===d)&&Object.keys(o[r].tiles).map(e=>o[r].tiles[e]).some(e=>0===e.opacity))&&(i.redrawTiles=!1,c(m)),l.attr({x:g*y-h,y:f*y-x,width:Math.ceil(y)+1,height:Math.ceil(y)+1})}}}else(0,n.error)("Highcharts warning: Tiles Provider not defined in the Provider Registry.",!1)}update(e){let{transformGroups:t}=this,o=this.chart,r=o.mapView,{provider:i}=e;if(t&&(t.forEach(e=>{0!==Object.keys(e).length&&e.destroy()}),this.transformGroups=[]),r&&!(0,n.defined)(o.userOptions.mapView?.projection)&&i?.type){let e=l[i.type];e&&r.update({projection:{name:new e().initialProjectionName}},!1)}super.update.apply(this,arguments)}}f.defaultOptions=(0,n.merge)(u.defaultOptions,{states:{inactive:{enabled:!1}}}),d().registerSeriesType("tiledwebmap",f);let x=p();x.TilesProviderRegistry=x.TilesProviderRegistry||l,f.compose(x.MapView);let M=p();return s.default})());