slippy-tile
Advanced tools
Comparing version 1.8.5 to 1.9.0
# Changelog | ||
## 1.9.0 - 2017-02-17 | ||
- Add case insenstive to replacements | ||
- Replace `{bbox}` with meters instead of degrees | ||
## 1.8.0 - 2017-02-14 | ||
@@ -5,0 +10,0 @@ |
31
index.js
@@ -45,6 +45,13 @@ const mercator = require('global-mercator') | ||
function wms (tile, url) { | ||
url = url.replace(/{height}/, '256') | ||
url = url.replace(/{width}/, '256') | ||
url = url.replace(/{proj}/, 'EPSG:3857') | ||
if (url.match(/{bbox}/)) { url = url.replace(/{bbox}/, mercator.googleToBBox(tile).join(',')) } | ||
url = url.replace(/{height}/gi, '256') | ||
url = url.replace(/{width}/gi, '256') | ||
url = url.replace(/{(proj|srs|crs)}/gi, 'EPSG:3857') | ||
let bbox | ||
if (url.match(/EPSG:3857/i)) { | ||
bbox = mercator.bboxToMeters(mercator.googleToBBox(tile)) | ||
} else { | ||
bbox = mercator.googleToBBox(tile) | ||
} | ||
if (url.match(/{bbox}/i)) { url = url.replace(/{bbox}/gi, bbox.join(',')) } | ||
return url | ||
@@ -64,7 +71,7 @@ } | ||
function wmts (url) { | ||
url = url.replace(/{TileCol}/, '{x}') | ||
url = url.replace(/{TileRow}/, '{y}') | ||
url = url.replace(/{TileMatrix}/, '{z}') | ||
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible') | ||
url = url.replace(/{Style}/, 'default') | ||
url = url.replace(/{TileCol}/gi, '{x}') | ||
url = url.replace(/{TileRow}/gi, '{y}') | ||
url = url.replace(/{TileMatrix}/gi, '{z}') | ||
url = url.replace(/{TileMatrixSet}/gi, 'GoogleMapsCompatible') | ||
url = url.replace(/{Style}/gi, 'default') | ||
return url | ||
@@ -85,8 +92,8 @@ } | ||
// Default simple switch | ||
if (url.match(/{s}/i)) { | ||
if (url.match(/{s}/)) { | ||
const random = String(sample(['a', 'b', 'c'])) | ||
return url.replace(/{s}/, random) | ||
return url.replace(/{s}/gi, random) | ||
} | ||
// Custom switch | ||
const pattern = /{switch:([a-z,\d]*)}/i | ||
const pattern = /{switch:([a-z,\d]*)}/ | ||
const found = url.match(pattern) | ||
@@ -93,0 +100,0 @@ if (found) { |
{ | ||
"name": "slippy-tile", | ||
"version": "1.8.5", | ||
"version": "1.9.0", | ||
"description": "Helps convert Slippy Map url tile schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -46,6 +46,13 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.slippyTile = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function wms (tile, url) { | ||
url = url.replace(/{height}/, '256') | ||
url = url.replace(/{width}/, '256') | ||
url = url.replace(/{proj}/, 'EPSG:3857') | ||
if (url.match(/{bbox}/)) { url = url.replace(/{bbox}/, mercator.googleToBBox(tile).join(',')) } | ||
url = url.replace(/{height}/gi, '256') | ||
url = url.replace(/{width}/gi, '256') | ||
url = url.replace(/{(proj|srs|crs)}/gi, 'EPSG:3857') | ||
let bbox | ||
if (url.match(/EPSG:3857/i)) { | ||
bbox = mercator.bboxToMeters(mercator.googleToBBox(tile)) | ||
} else { | ||
bbox = mercator.googleToBBox(tile) | ||
} | ||
if (url.match(/{bbox}/i)) { url = url.replace(/{bbox}/gi, bbox.join(',')) } | ||
return url | ||
@@ -65,7 +72,7 @@ } | ||
function wmts (url) { | ||
url = url.replace(/{TileCol}/, '{x}') | ||
url = url.replace(/{TileRow}/, '{y}') | ||
url = url.replace(/{TileMatrix}/, '{z}') | ||
url = url.replace(/{TileMatrixSet}/, 'GoogleMapsCompatible') | ||
url = url.replace(/{Style}/, 'default') | ||
url = url.replace(/{TileCol}/gi, '{x}') | ||
url = url.replace(/{TileRow}/gi, '{y}') | ||
url = url.replace(/{TileMatrix}/gi, '{z}') | ||
url = url.replace(/{TileMatrixSet}/gi, 'GoogleMapsCompatible') | ||
url = url.replace(/{Style}/gi, 'default') | ||
return url | ||
@@ -86,8 +93,8 @@ } | ||
// Default simple switch | ||
if (url.match(/{s}/i)) { | ||
if (url.match(/{s}/)) { | ||
const random = String(sample(['a', 'b', 'c'])) | ||
return url.replace(/{s}/, random) | ||
return url.replace(/{s}/gi, random) | ||
} | ||
// Custom switch | ||
const pattern = /{switch:([a-z,\d]*)}/i | ||
const pattern = /{switch:([a-z,\d]*)}/ | ||
const found = url.match(pattern) | ||
@@ -94,0 +101,0 @@ if (found) { |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.slippyTile=e()}}(function(){return function e(t,r,o){function a(n,s){if(!r[n]){if(!t[n]){var p="function"==typeof require&&require;if(!s&&p)return p(n,!0);if(i)return i(n,!0);var l=new Error("Cannot find module '"+n+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[n]={exports:{}};t[n][0].call(c.exports,function(e){var r=t[n][1][e];return a(r?r:e)},c,c.exports,e,t,r,o)}return r[n].exports}for(var i="function"==typeof require&&require,n=0;n<o.length;n++)a(o[n]);return a}({1:[function(e,t,r){function o(e,t){const[r,o,s]=e;if(t=a(e,t),t=i(t),t=n(t),t=t.replace(/{(zoom|z|level)}/,String(s)),t=t.replace(/{(x|col)}/,String(r)),t=t.replace(/{(y|row)}/,String(o)),t.match(/{-y}/)&&(t=t.replace(/{-y}/,String(p.googleToTile(e)[1]))),t.match(/{(quadkey|q)}/)&&(t=t.replace(/{(quadkey|q)}/,p.googleToQuadkey(e))),t.match(/{.*}/))throw new Error(`Could not completly parse URL ${t}`);return t}function a(e,t){return t=t.replace(/{height}/,"256"),t=t.replace(/{width}/,"256"),t=t.replace(/{proj}/,"EPSG:3857"),t.match(/{bbox}/)&&(t=t.replace(/{bbox}/,p.googleToBBox(e).join(","))),t}function i(e){return e=e.replace(/{TileCol}/,"{x}"),e=e.replace(/{TileRow}/,"{y}"),e=e.replace(/{TileMatrix}/,"{z}"),e=e.replace(/{TileMatrixSet}/,"GoogleMapsCompatible"),e=e.replace(/{Style}/,"default")}function n(e){if(e.match(/{s}/i)){const t=String(s(["a","b","c"]));return e.replace(/{s}/,t)}const t=/{switch:([a-z,\d]*)}/i,r=e.match(t);if(r){const o=String(s(r[1].split(",")));return e.replace(t,o)}return e}function s(e){return e[Math.floor(Math.random()*e.length)]}const p=e("global-mercator"),l=e("./providers");t.exports.providers=l,t.exports.parse=o,t.exports.wms=a,t.exports.wmts=i,t.exports.parseSwitch=n,t.exports.sample=s},{"./providers":6,"global-mercator":2}],2:[function(e,t,r){function o(e){const[t,r,o]=e;return(1<<o)*((1<<o)+t)+r}function a(e){const[t,r,o,a]=e;let i=(t-o)/2+o,n=(r-a)/2+a;return i=Number(i.toFixed(6)),n=Number(n.toFixed(6)),[i,n]}function i(e){const[t,r]=k(e);let o=t*A/180,a=Math.log(Math.tan((90+r)*Math.PI/360))/(Math.PI/180);return a=a*A/180,o=Number(o.toFixed(1)),a=Number(a.toFixed(1)),[o,a]}function n(e){const[t,r]=e;let o=t/A*180,a=r/A*180;return a=180/Math.PI*(2*Math.atan(Math.exp(a*Math.PI/180))-Math.PI/2),o=Number(o.toFixed(6)),a=Number(a.toFixed(6)),[o,a]}function s(e,t){const[r,o]=e,a=j(t),i=(r+A)/a,n=(o+A)/a;return[i,n,t]}function p(e,t){const r=i(k(e)),o=s(r,t);return g(o)}function l(e,t){if(0===t)return[0,0,0];const r=p(k(e),t);return y(r)}function c(e,t){if(0===t)return[0,0,0];const r=s(e,t);return g(r)}function u(e){const[t,r,o]=C(e),a=j(o);let i=t*a-A,n=r*a-A;return i=Number(i.toFixed(1)),n=Number(n.toFixed(1)),[i,n]}function g(e){const[t,r,o]=C(e);if(0===o)return[0,0,0];let a=Math.ceil(t/256)-1,i=Math.ceil(r/256)-1;return a<0&&(a=0),i<0&&(i=0),[a,i,o]}function m(e){const[t,r,o]=O(e);let a=u([256*t,256*r,o]),i=u([256*(t+1),256*(r+1),o]);return[a[0],a[1],i[0],i[1]]}function d(e){const[t,r,o]=O(e);if(0===o)return[-180,-85.05112877980659,180,85.05112877980659];const[a,i,s,p]=m([t,r,o]),l=n([a,i,o]),c=n([s,p,o]);return[l[0],l[1],c[0],c[1]]}function f(e){const t=x(e);return m(t)}function h(e){const t=x(e);return d(t)}function y(e){const[t,r,o]=O(e);if(0===o)return[0,0,0];const a=t,i=Math.pow(2,o)-1-r;return[a,i,o]}function x(e){const[t,r,o]=e,a=t,i=Math.pow(2,o)-r-1;return[a,i,o]}function b(e){const t=x(e);return M(t)}function M(e){let[t,r,o]=O(e);if(0===o)return"";let a="";return r=Math.pow(2,o)-1-r,W(o,0,-1).map(e=>{let o=0,i=1<<e-1;0!==(t&i)&&(o+=1),0!==(r&i)&&(o+=2),a=a.concat(o)}),a}function T(e){const t=S(e);return x(t)}function S(e){let t=0,r=0;const o=e.length;return W(o,0,-1).map(a=>{let i=1<<a-1;switch(parseInt(e[o-a],0)){case 0:break;case 1:t+=i;break;case 2:r+=i;break;case 3:t+=i,r+=i;break;default:throw new Error("Invalid Quadkey digit sequence")}}),[t,r,o]}function w(e){const t=i([e[0],e[1]]),r=i([e[2],e[3]]);return[t[0],t[1],r[0],r[1]]}function*v(e,t,r){for(const[o,a,i]of I(e,t,r))for(const n of a)for(const s of o)yield[s,n,i]}function*E(e,t,r,o){const a=v(e,t,r);let i=[],n=0;for(;;){n++;const{value,done}=a.next();if(value&&i.push(value),n%o===0&&(yield i,i=[]),done){yield i;break}}}function I(e,t,r){const o=[];for(let a of W(t,r+1)){let[t,r,i,n]=e,s=p([t,r],a),l=p([i,n],a),c=Math.min(s[1],l[1]),u=Math.max(s[1],l[1]),g=Math.min(s[0],l[0]),m=Math.max(s[0],l[0]);const d=W(c,u+1),f=W(g,m+1);o.push([f,d,a])}return o}function N(e,t,r){let o=0;for(const[a,i]of I(e,t,r))o+=i.length*a.length;return o}function O(e){const[t,r,o]=e;if(G(o),t<0){const e="<x> must not be less than 0";throw new Error(e)}if(r<0){const e="<y> must not be less than 0";throw new Error(e)}const a=Math.pow(2,o);if(t>=a||r>=a)throw new Error("Illegal parameters for tile");return e}function G(e){if(e<0){const e="<zoom> cannot be less than 0";throw new Error(e)}if(e>30){const e="<zoom> cannot be greater than 30";throw new Error(e)}return e}function k(e){const[t,r]=e;if(r<-90||r>90){const e="LngLat [lat] must be within -90 to 90 degrees";throw new Error(e)}if(t<-180||t>180){const e="LngLat [lng] must be within -180 to 180 degrees";throw new Error(e)}return[t,r]}function C(e){return e}function j(e){return R/Math.pow(2,e)}function W(e,t,r){null==t&&(t=e||0,e=0),r||(r=t<e?-1:1);const o=Math.max(Math.ceil((t-e)/r),0),a=Array(o);for(let i=0;i<o;i++,e+=r)a[i]=e;return a}const R=2*Math.PI*6378137/256,A=2*Math.PI*6378137/2;t.exports.hash=o,t.exports.bboxToCenter=a,t.exports.lngLatToMeters=i,t.exports.metersToLngLat=n,t.exports.metersToPixels=s,t.exports.lngLatToTile=p,t.exports.lngLatToGoogle=l,t.exports.metersToTile=c,t.exports.pixelsToMeters=u,t.exports.pixelsToTile=g,t.exports.tileToBBoxMeters=m,t.exports.tileToBBox=d,t.exports.googleToBBoxMeters=f,t.exports.googleToBBox=h,t.exports.tileToGoogle=y,t.exports.googleToTile=x,t.exports.googleToQuadkey=b,t.exports.tileToQuadkey=M,t.exports.quadkeyToTile=T,t.exports.quadkeyToGoogle=S,t.exports.bboxToMeters=w,t.exports.grid=v,t.exports.gridBulk=E,t.exports.gridLevels=I,t.exports.gridCount=N,t.exports.validateTile=O,t.exports.validateZoom=G,t.exports.validateLngLat=k,t.exports.validatePixels=C,t.exports.resolution=j,t.exports.range=W},{}],3:[function(e,t,r){t.exports.imagery={name:"Bing Imagery",categories:["bing","imagery","world"],url:"https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=5250",description:"Tiles from Bing",attribution:"Map data © Bing",format:"jpg",type:"baselayer"}},{}],4:[function(e,t,r){t.exports.hybrid={attribution:"© DigitalGlobe, © OpenStreetMap, © Mapbox",categories:["digitalglobe","dg","imagery","street","hybrid","world"],description:"Tiles from DigitalGlobe",name:"DigitalGlobe Hybrid",format:"jpg",url:"https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0mpda/{z}/{x}/{y}",type:"baselayer"},t.exports.imagery={name:"DigitalGlobe Imagery",categories:["digitalgloble","dg","imagery","world"],url:"https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0g75k/{z}/{x}/{y}",description:"Tiles from DigitalGlobe",attribution:"© DigitalGlobe",format:"jpg",type:"baselayer"}},{}],5:[function(e,t,r){t.exports.natgeo={name:"ESRI National Geographic World Map",categories:["esri","national","geographic","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.",attribution:"National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, INCREMENT P",format:"jpg",type:"baselayer"},t.exports.ocean={name:"ESRI Ocean Basemap",categories:["esri","ocean","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/Ocean_Basemap/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"The ocean basemap includes bathymetry, surface and subsurface feature names, and derived depths. This service is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data.",attribution:"Esri, GEBCO, NOAA, National Geographic, DeLorme, HERE, Geonames.org, and other contributors",format:"jpg",type:"baselayer"},t.exports.usatopo={name:"ESRI USA Topo Maps",categories:["esri","topo","topographicusa"],url:"https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents detailed USGS topographic maps for the United States at multiple scales.",attribution:"© 2011 National Geographic Society, i-cubed",format:"jpg",type:"baselayer"},t.exports.imagery={name:"ESRI World Imagery",categories:["esri","imagery","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents satellite imagery for the world and high-resolution imagery for the United States and other areas around the world.",attribution:"Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community",format:"jpg",type:"baselayer"},t.exports.street={name:"ESRI World Street Map",categories:["esri","street","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer/WMTS/tile/1.0.0/World_Topo_Map/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents highway-level data for the world and street-level data for North America, Europe, Africa, parts of the Middle East, Asia, and more.",attribution:"Esri, HERE, DeLorme, USGS, Intermap, INCREMENT P, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), MapmyIndia, © OpenStreetMap contributors, and the GIS User Community",format:"jpg",type:"baselayer"},t.exports.topo={name:"ESRI World Topographic Map",categories:["esri","topo","topographic","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This world topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings.",attribution:"Esri, HERE, DeLorme, Intermap, INCREMENT P, GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), swisstopo, MapmyIndia, © OpenStreetMap contributors, GIS User Community",format:"jpg",type:"baselayer"}},{}],6:[function(e,t,r){const o=e("./bing"),a=e("./esri"),i=e("./openstreetmap"),n=e("./strava"),s=e("./digitalglobe"),p=e("./mapbox");t.exports={digitalglobe:s,mapbox:p,esri:a,bing:o,openstreetmap:i,strava:n}},{"./bing":3,"./digitalglobe":4,"./esri":5,"./mapbox":7,"./openstreetmap":8,"./strava":9}],7:[function(e,t,r){t.exports.outdoors={name:"Mapbox Outdoors",categories:["mapbox","classic","outdoors","topo","world"],url:"https://{s}.tiles.mapbox.com/v4/aj.um7z9lus/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpbG10dnA3NzY3OTZ0dmtwejN2ZnUycjYifQ.1W5oTOnWXQ9R1w8u3Oo1yA",description:"Tiles from Mapbox",attribution:"© Mapbox, OpenStreetMap",format:"png",type:"overlay"},t.exports.imagery={name:"Mapbox Imagery",categories:["mapbox","imagery","world"],url:"https://{s}.tiles.mapbox.com/v4/openstreetmap.map-inh7ifmo/{z}/{x}/{y}.jpg?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpbG10dnA3NzY3OTZ0dmtwejN2ZnUycjYifQ.1W5oTOnWXQ9R1w8u3Oo1yA",description:"Tiles from Mapbox",attribution:"© Mapbox, OpenStreetMap",format:"jpg",type:"baselayer"}},{}],8:[function(e,t,r){t.exports.standard={name:"OpenStreetMap Standard",categories:["openstreetmap","standard","world"],url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.cycle={name:"OpenStreetMap Cycle Map",categories:["openstreetmap","cycle","world"],url:"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.hot={name:"OpenStreetMap Humanitarian",categories:["openstreetmap","hot","humanitarian","world"],url:"https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.transport={name:"OpenStreetMap Transport Map",categories:["openstreetmap","transport","world"],url:"https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.wikimedia={name:"OpenStreetMap Wikimedia",categories:["openstreetmap","wikimedia","world"],url:"https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",description:"Tiles from OSM",attribution:"Map data © OSM",format:"png",type:"baselayer"},t.exports.lyrk={name:"OpenStreetMap Lyrk",categories:["openstreetmap","lyrk","world"],url:"https://tiles.lyrk.org/ls/{z}/{x}/{y}?apikey=6e8cfef737a140e2a58c8122aaa26077",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"}},{}],9:[function(e,t,r){t.exports.both={name:"Strava Cycling & Running",categories:["strava","cycling","running","world"],url:"https://globalheat.strava.com/tiles/both/color/{z}/{x}/{y}.png",description:"Tiles from Strava",attribution:"Map data © Strava",format:"png",type:"overlay"}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.slippyTile=e()}}(function(){return function e(t,r,o){function a(n,s){if(!r[n]){if(!t[n]){var p="function"==typeof require&&require;if(!s&&p)return p(n,!0);if(i)return i(n,!0);var l=new Error("Cannot find module '"+n+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[n]={exports:{}};t[n][0].call(c.exports,function(e){var r=t[n][1][e];return a(r?r:e)},c,c.exports,e,t,r,o)}return r[n].exports}for(var i="function"==typeof require&&require,n=0;n<o.length;n++)a(o[n]);return a}({1:[function(e,t,r){function o(e,t){const[r,o,s]=e;if(t=a(e,t),t=i(t),t=n(t),t=t.replace(/{(zoom|z|level)}/,String(s)),t=t.replace(/{(x|col)}/,String(r)),t=t.replace(/{(y|row)}/,String(o)),t.match(/{-y}/)&&(t=t.replace(/{-y}/,String(p.googleToTile(e)[1]))),t.match(/{(quadkey|q)}/)&&(t=t.replace(/{(quadkey|q)}/,p.googleToQuadkey(e))),t.match(/{.*}/))throw new Error(`Could not completly parse URL ${t}`);return t}function a(e,t){t=t.replace(/{height}/gi,"256"),t=t.replace(/{width}/gi,"256"),t=t.replace(/{(proj|srs|crs)}/gi,"EPSG:3857");let r;return r=t.match(/EPSG:3857/i)?p.bboxToMeters(p.googleToBBox(e)):p.googleToBBox(e),t.match(/{bbox}/i)&&(t=t.replace(/{bbox}/gi,r.join(","))),t}function i(e){return e=e.replace(/{TileCol}/gi,"{x}"),e=e.replace(/{TileRow}/gi,"{y}"),e=e.replace(/{TileMatrix}/gi,"{z}"),e=e.replace(/{TileMatrixSet}/gi,"GoogleMapsCompatible"),e=e.replace(/{Style}/gi,"default")}function n(e){if(e.match(/{s}/)){const t=String(s(["a","b","c"]));return e.replace(/{s}/gi,t)}const t=/{switch:([a-z,\d]*)}/,r=e.match(t);if(r){const o=String(s(r[1].split(",")));return e.replace(t,o)}return e}function s(e){return e[Math.floor(Math.random()*e.length)]}const p=e("global-mercator"),l=e("./providers");t.exports.providers=l,t.exports.parse=o,t.exports.wms=a,t.exports.wmts=i,t.exports.parseSwitch=n,t.exports.sample=s},{"./providers":6,"global-mercator":2}],2:[function(e,t,r){function o(e){const[t,r,o]=e;return(1<<o)*((1<<o)+t)+r}function a(e){const[t,r,o,a]=e;let i=(t-o)/2+o,n=(r-a)/2+a;return i=Number(i.toFixed(6)),n=Number(n.toFixed(6)),[i,n]}function i(e){const[t,r]=k(e);let o=t*A/180,a=Math.log(Math.tan((90+r)*Math.PI/360))/(Math.PI/180);return a=a*A/180,o=Number(o.toFixed(1)),a=Number(a.toFixed(1)),[o,a]}function n(e){const[t,r]=e;let o=t/A*180,a=r/A*180;return a=180/Math.PI*(2*Math.atan(Math.exp(a*Math.PI/180))-Math.PI/2),o=Number(o.toFixed(6)),a=Number(a.toFixed(6)),[o,a]}function s(e,t){const[r,o]=e,a=j(t),i=(r+A)/a,n=(o+A)/a;return[i,n,t]}function p(e,t){const r=i(k(e)),o=s(r,t);return g(o)}function l(e,t){if(0===t)return[0,0,0];const r=p(k(e),t);return y(r)}function c(e,t){if(0===t)return[0,0,0];const r=s(e,t);return g(r)}function u(e){const[t,r,o]=C(e),a=j(o);let i=t*a-A,n=r*a-A;return i=Number(i.toFixed(1)),n=Number(n.toFixed(1)),[i,n]}function g(e){const[t,r,o]=C(e);if(0===o)return[0,0,0];let a=Math.ceil(t/256)-1,i=Math.ceil(r/256)-1;return a<0&&(a=0),i<0&&(i=0),[a,i,o]}function m(e){const[t,r,o]=O(e);let a=u([256*t,256*r,o]),i=u([256*(t+1),256*(r+1),o]);return[a[0],a[1],i[0],i[1]]}function d(e){const[t,r,o]=O(e);if(0===o)return[-180,-85.05112877980659,180,85.05112877980659];const[a,i,s,p]=m([t,r,o]),l=n([a,i,o]),c=n([s,p,o]);return[l[0],l[1],c[0],c[1]]}function f(e){const t=x(e);return m(t)}function h(e){const t=x(e);return d(t)}function y(e){const[t,r,o]=O(e);if(0===o)return[0,0,0];const a=t,i=Math.pow(2,o)-1-r;return[a,i,o]}function x(e){const[t,r,o]=e,a=t,i=Math.pow(2,o)-r-1;return[a,i,o]}function b(e){const t=x(e);return M(t)}function M(e){let[t,r,o]=O(e);if(0===o)return"";let a="";return r=Math.pow(2,o)-1-r,W(o,0,-1).map(e=>{let o=0,i=1<<e-1;0!==(t&i)&&(o+=1),0!==(r&i)&&(o+=2),a=a.concat(o)}),a}function T(e){const t=S(e);return x(t)}function S(e){let t=0,r=0;const o=e.length;return W(o,0,-1).map(a=>{let i=1<<a-1;switch(parseInt(e[o-a],0)){case 0:break;case 1:t+=i;break;case 2:r+=i;break;case 3:t+=i,r+=i;break;default:throw new Error("Invalid Quadkey digit sequence")}}),[t,r,o]}function w(e){const t=i([e[0],e[1]]),r=i([e[2],e[3]]);return[t[0],t[1],r[0],r[1]]}function*v(e,t,r){for(const[o,a,i]of I(e,t,r))for(const n of a)for(const s of o)yield[s,n,i]}function*E(e,t,r,o){const a=v(e,t,r);let i=[],n=0;for(;;){n++;const{value,done}=a.next();if(value&&i.push(value),n%o===0&&(yield i,i=[]),done){yield i;break}}}function I(e,t,r){const o=[];for(let a of W(t,r+1)){let[t,r,i,n]=e,s=p([t,r],a),l=p([i,n],a),c=Math.min(s[1],l[1]),u=Math.max(s[1],l[1]),g=Math.min(s[0],l[0]),m=Math.max(s[0],l[0]);const d=W(c,u+1),f=W(g,m+1);o.push([f,d,a])}return o}function N(e,t,r){let o=0;for(const[a,i]of I(e,t,r))o+=i.length*a.length;return o}function O(e){const[t,r,o]=e;if(G(o),t<0){const e="<x> must not be less than 0";throw new Error(e)}if(r<0){const e="<y> must not be less than 0";throw new Error(e)}const a=Math.pow(2,o);if(t>=a||r>=a)throw new Error("Illegal parameters for tile");return e}function G(e){if(e<0){const e="<zoom> cannot be less than 0";throw new Error(e)}if(e>30){const e="<zoom> cannot be greater than 30";throw new Error(e)}return e}function k(e){const[t,r]=e;if(r<-90||r>90){const e="LngLat [lat] must be within -90 to 90 degrees";throw new Error(e)}if(t<-180||t>180){const e="LngLat [lng] must be within -180 to 180 degrees";throw new Error(e)}return[t,r]}function C(e){return e}function j(e){return R/Math.pow(2,e)}function W(e,t,r){null==t&&(t=e||0,e=0),r||(r=t<e?-1:1);const o=Math.max(Math.ceil((t-e)/r),0),a=Array(o);for(let i=0;i<o;i++,e+=r)a[i]=e;return a}const R=2*Math.PI*6378137/256,A=2*Math.PI*6378137/2;t.exports.hash=o,t.exports.bboxToCenter=a,t.exports.lngLatToMeters=i,t.exports.metersToLngLat=n,t.exports.metersToPixels=s,t.exports.lngLatToTile=p,t.exports.lngLatToGoogle=l,t.exports.metersToTile=c,t.exports.pixelsToMeters=u,t.exports.pixelsToTile=g,t.exports.tileToBBoxMeters=m,t.exports.tileToBBox=d,t.exports.googleToBBoxMeters=f,t.exports.googleToBBox=h,t.exports.tileToGoogle=y,t.exports.googleToTile=x,t.exports.googleToQuadkey=b,t.exports.tileToQuadkey=M,t.exports.quadkeyToTile=T,t.exports.quadkeyToGoogle=S,t.exports.bboxToMeters=w,t.exports.grid=v,t.exports.gridBulk=E,t.exports.gridLevels=I,t.exports.gridCount=N,t.exports.validateTile=O,t.exports.validateZoom=G,t.exports.validateLngLat=k,t.exports.validatePixels=C,t.exports.resolution=j,t.exports.range=W},{}],3:[function(e,t,r){t.exports.imagery={name:"Bing Imagery",categories:["bing","imagery","world"],url:"https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=5250",description:"Tiles from Bing",attribution:"Map data © Bing",format:"jpg",type:"baselayer"}},{}],4:[function(e,t,r){t.exports.hybrid={attribution:"© DigitalGlobe, © OpenStreetMap, © Mapbox",categories:["digitalglobe","dg","imagery","street","hybrid","world"],description:"Tiles from DigitalGlobe",name:"DigitalGlobe Hybrid",format:"jpg",url:"https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0mpda/{z}/{x}/{y}",type:"baselayer"},t.exports.imagery={name:"DigitalGlobe Imagery",categories:["digitalgloble","dg","imagery","world"],url:"https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0g75k/{z}/{x}/{y}",description:"Tiles from DigitalGlobe",attribution:"© DigitalGlobe",format:"jpg",type:"baselayer"}},{}],5:[function(e,t,r){t.exports.natgeo={name:"ESRI National Geographic World Map",categories:["esri","national","geographic","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.",attribution:"National Geographic, Esri, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, INCREMENT P",format:"jpg",type:"baselayer"},t.exports.ocean={name:"ESRI Ocean Basemap",categories:["esri","ocean","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/Ocean_Basemap/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"The ocean basemap includes bathymetry, surface and subsurface feature names, and derived depths. This service is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data.",attribution:"Esri, GEBCO, NOAA, National Geographic, DeLorme, HERE, Geonames.org, and other contributors",format:"jpg",type:"baselayer"},t.exports.usatopo={name:"ESRI USA Topo Maps",categories:["esri","topo","topographicusa"],url:"https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents detailed USGS topographic maps for the United States at multiple scales.",attribution:"© 2011 National Geographic Society, i-cubed",format:"jpg",type:"baselayer"},t.exports.imagery={name:"ESRI World Imagery",categories:["esri","imagery","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents satellite imagery for the world and high-resolution imagery for the United States and other areas around the world.",attribution:"Esri, DigitalGlobe, Earthstar Geographics, CNES/Airbus DS, GeoEye, USDA FSA, USGS, Getmapping, Aerogrid, IGN, IGP, and the GIS User Community",format:"jpg",type:"baselayer"},t.exports.street={name:"ESRI World Street Map",categories:["esri","street","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer/WMTS/tile/1.0.0/World_Topo_Map/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This map service presents highway-level data for the world and street-level data for North America, Europe, Africa, parts of the Middle East, Asia, and more.",attribution:"Esri, HERE, DeLorme, USGS, Intermap, INCREMENT P, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), MapmyIndia, © OpenStreetMap contributors, and the GIS User Community",format:"jpg",type:"baselayer"},t.exports.topo={name:"ESRI World Topographic Map",categories:["esri","topo","topographic","world"],url:"https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS/tile/1.0.0/World_Imagery/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpg",description:"This world topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings.",attribution:"Esri, HERE, DeLorme, Intermap, INCREMENT P, GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), swisstopo, MapmyIndia, © OpenStreetMap contributors, GIS User Community",format:"jpg",type:"baselayer"}},{}],6:[function(e,t,r){const o=e("./bing"),a=e("./esri"),i=e("./openstreetmap"),n=e("./strava"),s=e("./digitalglobe"),p=e("./mapbox");t.exports={digitalglobe:s,mapbox:p,esri:a,bing:o,openstreetmap:i,strava:n}},{"./bing":3,"./digitalglobe":4,"./esri":5,"./mapbox":7,"./openstreetmap":8,"./strava":9}],7:[function(e,t,r){t.exports.outdoors={name:"Mapbox Outdoors",categories:["mapbox","classic","outdoors","topo","world"],url:"https://{s}.tiles.mapbox.com/v4/aj.um7z9lus/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpbG10dnA3NzY3OTZ0dmtwejN2ZnUycjYifQ.1W5oTOnWXQ9R1w8u3Oo1yA",description:"Tiles from Mapbox",attribution:"© Mapbox, OpenStreetMap",format:"png",type:"overlay"},t.exports.imagery={name:"Mapbox Imagery",categories:["mapbox","imagery","world"],url:"https://{s}.tiles.mapbox.com/v4/openstreetmap.map-inh7ifmo/{z}/{x}/{y}.jpg?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpbG10dnA3NzY3OTZ0dmtwejN2ZnUycjYifQ.1W5oTOnWXQ9R1w8u3Oo1yA",description:"Tiles from Mapbox",attribution:"© Mapbox, OpenStreetMap",format:"jpg",type:"baselayer"}},{}],8:[function(e,t,r){t.exports.standard={name:"OpenStreetMap Standard",categories:["openstreetmap","standard","world"],url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.cycle={name:"OpenStreetMap Cycle Map",categories:["openstreetmap","cycle","world"],url:"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.hot={name:"OpenStreetMap Humanitarian",categories:["openstreetmap","hot","humanitarian","world"],url:"https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.transport={name:"OpenStreetMap Transport Map",categories:["openstreetmap","transport","world"],url:"https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"},t.exports.wikimedia={name:"OpenStreetMap Wikimedia",categories:["openstreetmap","wikimedia","world"],url:"https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",description:"Tiles from OSM",attribution:"Map data © OSM",format:"png",type:"baselayer"},t.exports.lyrk={name:"OpenStreetMap Lyrk",categories:["openstreetmap","lyrk","world"],url:"https://tiles.lyrk.org/ls/{z}/{x}/{y}?apikey=6e8cfef737a140e2a58c8122aaa26077",description:"Tiles from OpenStreetMap",attribution:"Map data © OpenStreetMap",format:"png",type:"baselayer"}},{}],9:[function(e,t,r){t.exports.both={name:"Strava Cycling & Running",categories:["strava","cycling","running","world"],url:"https://globalheat.strava.com/tiles/both/color/{z}/{x}/{y}.png",description:"Tiles from Strava",attribution:"Map data © Strava",format:"png",type:"overlay"}},{}]},{},[1])(1)}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69694
1476