map-tile-utils 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of map-tile-utils might be problematic. Click here for more details.

package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # map-tile-utils
2
+ 地图瓦片裁剪和瓦片重投影计算工具库
@@ -0,0 +1 @@
1
+ "use strict";function _0xc74c(t,r){var n=_0x82c1();return(_0xc74c=function(t,r){return n[t-=384]})(t,r)}!function(){for(var t=_0xc74c,r=_0x82c1();;)try{if(254998===-parseInt(t(390))/1*(-parseInt(t(386))/2)+parseInt(t(395))/3+-parseInt(t(396))/4+-parseInt(t(394))/5*(parseInt(t(402))/6)+-parseInt(t(389))/7*(parseInt(t(385))/8)+parseInt(t(392))/9+parseInt(t(403))/10)break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var t=function(){var t=_0xc74c;function _0xc9466f(){var t=_0xc74c;this[t(406)]={x:-20037508.34,y:20037508.34},this[t(384)]=256}return _0xc9466f[t(393)][t(397)]=function(r){var n=t;return 2*this.origin.y/(Math[n(398)](2,r)*this[n(384)])},_0xc9466f[t(393)][t(401)]=function(r,n,a){var e=t,i=this[e(397)](r),s=n*this[e(384)]*i+this[e(406)].x,h=(n+1)*this.tileSize*i+this[e(406)].x;return[s,this.origin.y-(a+1)*this[e(384)]*i,h,this.origin.y-a*this[e(384)]*i]},_0xc9466f.prototype[t(399)]=function(r,n,a){var e=t,i=this[e(397)](r);return[(n-this[e(406)].x)/i,(this[e(406)].y-a)/i]},_0xc9466f.prototype.tileToScreen_bd=function(r,n,a){var e=Math[t(398)](2,18-r);return[(n-this.origin.x)/e,-a/e]},_0xc9466f.prototype[t(400)]=function(r,n,a){var e=t,i=this[e(397)](r)*this.tileSize;return[Math[e(391)]((n-this[e(406)].x)/i),Math[e(391)]((this.origin.y-a)/i)]},_0xc9466f.prototype.getTileCroppingInfo=function(r,n,a,e){var i=t;if(void 0===e&&(e=18),r>e){var s=this[i(401)](r,n,a),h=s[0],o=s[1],c=s[2],u=s[3],f=this[i(400)](e,(h+c)/2,(o+u)/2),_=f[0],x=f[1],M=this[i(401)](e,_,x),p=M[0];M[1],M[2];var l=M[3],I=this[i(399)](e,p,l),v=I[0],g=I[1],d=this[i(399)](e,h,u),y=d[0],b=d[1],T=this.tileToScreen(e,c,o),m=T[0],w=T[1],P=Math[i(404)](y-v),z=Math[i(404)](b-g);return{m_z:e,m_x:_,m_y:x,scr_x:P,scr_y:z,scr_w:Math[i(404)](m-v-P),scr_h:Math[i(404)](w-g-z),t_size:this[i(384)]}}return{m_z:r,m_x:n,m_y:a,t_size:this[i(384)]}},_0xc9466f[t(393)][t(405)]=function(r,n,a,e){var i=t;void 0===e&&(e=18);var s=a<=e?a:e,h=r[0],o=r[1],c=r[2],u=r[3],f=this[i(400)](s,(h+c)/2,(o+u)/2),_=f[0],x=f[1],M=n[0];n[1],n[2];var p=n[3],l=this[i(399)](s,M,p),I=l[0],v=l[1],g=this[i(399)](s,h,u),d=g[0],y=g[1],b=this[i(399)](s,c,o),T=b[0],m=b[1],w=Math.round(d-I),P=Math[i(404)](y-v);return{m_z:e,m_x:_,m_y:x,scr_x:w,scr_y:P,scr_w:Math.round(T-I-w),scr_h:Math.round(m-v-P),t_size:this.tileSize}},_0xc9466f[t(393)][t(387)]=function(r,n,a,e){var i=t;void 0===e&&(e=18);var s=a<=e?a:e,h=r[0],o=r[1],c=r[2],u=r[3],f=this[i(400)](s,(h+c)/2,(o+u)/2),_=f[0],x=f[1],M=n[0];n[1],n[2];var p=n[3],l=this.tileToScreen_bd(s,M,p),I=l[0],v=l[1],g=this.tileToScreen_bd(s,h,u),d=g[0],y=g[1],b=this[i(388)](s,c,o),T=b[0],m=b[1],w=Math[i(404)](d-I),P=Math[i(404)](y-v);return{m_z:e,m_x:_,m_y:x,scr_x:w,scr_y:P,scr_w:Math[i(404)](T-I-w),scr_h:Math.round(m-v-P),t_size:this[i(384)]}},_0xc9466f}();function _0x82c1(){var t=["6926150OgphIl","round","getTileCroppingInfoByExtent","origin","tileSize","14472TVIObh","56vxeeTe","getTileCroppingInfoByExtent_bd","tileToScreen_bd","378zksRav","4162UMDMHV","floor","362223SMuQQG","prototype","92240scOSpE","699840RmGORR","1591720aHRuQn","getTileRes","pow","tileToScreen","calcTileIndex","getTileBounds","108FQItfJ"];return(_0x82c1=function(){return t})()}function _0x4129(){var t=["getTileRes","getTileCroppingInfo","586530EGFHrx","1245096hAiEmp","96803wIAeqv","137654yXJICV","tileToScreen","84RtEmsy","getTileCroppingInfoByExtent","floor","calcTileIndex","getTileBounds","1DOBRif","50byvKlk","857352xeEGQA","round","tileSize","6108OtLLuq","prototype","6EVOhEx","pow","58977Jzudxl","origin","33WBmCBL"];return(_0x4129=function(){return t})()}function _0x51be(t,r){var n=_0x4129();return(_0x51be=function(t,r){return n[t-=356]})(t,r)}!function(){for(var t=_0x51be,r=_0x4129();;)try{if(131270===-parseInt(t(361))/1*(-parseInt(t(378))/2)+parseInt(t(366))/3*(-parseInt(t(356))/4)+parseInt(t(375))/5+parseInt(t(368))/6*(parseInt(t(377))/7)+parseInt(t(376))/8+parseInt(t(370))/9*(parseInt(t(362))/10)+parseInt(t(372))/11*(-parseInt(t(363))/12))break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var r=function(){var t=_0x51be;function _0x557d95(){var t=_0x51be;this[t(371)]={x:-180,y:90},this[t(365)]=256}return _0x557d95[t(367)].getTileRes=function(r){var n=t;return 2*this.origin.y/(Math[n(369)](2,r-1)*this[n(365)])},_0x557d95[t(367)][t(360)]=function(r,n,a){var e=t,i=this.getTileRes(r),s=n*this.tileSize*i+this[e(371)].x,h=(n+1)*this[e(365)]*i+this[e(371)].x;return[s,this[e(371)].y-(a+1)*this[e(365)]*i,h,this.origin.y-a*this.tileSize*i]},_0x557d95.prototype[t(379)]=function(r,n,a){var e=t,i=this[e(373)](r);return[(n-this[e(371)].x)/i,(this[e(371)].y-a)/i]},_0x557d95[t(367)][t(359)]=function(r,n,a){var e=t,i=this[e(373)](r)*this[e(365)];return[Math[e(358)]((n-this.origin.x)/i),Math[e(358)]((this[e(371)].y-a)/i)]},_0x557d95[t(367)][t(374)]=function(r,n,a,e){var i=t;if(void 0===e&&(e=18),r>e){var s=this.getTileBounds(r,n,a),h=s[0],o=s[1],c=s[2],u=s[3],f=this[i(359)](e,(h+c)/2,(o+u)/2),_=f[0],x=f[1],M=this.getTileBounds(e,_,x),p=M[0];M[1],M[2];var l=M[3],I=this[i(379)](e,p,l),v=I[0],g=I[1],d=this.tileToScreen(e,h,u),y=d[0],b=d[1],T=this.tileToScreen(e,c,o),m=T[0],w=T[1],P=Math[i(364)](y-v),z=Math[i(364)](b-g);return{m_z:e,m_x:_,m_y:x,scr_x:P,scr_y:z,scr_w:Math[i(364)](m-v-P),scr_h:Math[i(364)](w-g-z),t_size:this[i(365)]}}return{m_z:r,m_x:n,m_y:a,t_size:this[i(365)]}},_0x557d95[t(367)][t(357)]=function(r,n,a,e){var i=t;void 0===e&&(e=18);var s=a<=e?a:e,h=r[0],o=r[1],c=r[2],u=r[3],f=this[i(359)](s,(h+c)/2,(o+u)/2),_=f[0],x=f[1],M=n[0];n[1],n[2];var p=n[3],l=this.tileToScreen(s,M,p),I=l[0],v=l[1],g=this.tileToScreen(s,h,u),d=g[0],y=g[1],b=this[i(379)](s,c,o),T=b[0],m=b[1],w=Math[i(364)](d-I),P=Math[i(364)](y-v);return{m_z:e,m_x:_,m_y:x,scr_x:w,scr_y:P,scr_w:Math.round(T-I-w),scr_h:Math[i(364)](m-v-P),t_size:this.tileSize}},_0x557d95}();!function(){for(var t=_0x6a70,r=_0x2276();;)try{if(888398===parseInt(t(316))/1+parseInt(t(317))/2+-parseInt(t(307))/3*(-parseInt(t(328))/4)+parseInt(t(336))/5+-parseInt(t(310))/6*(-parseInt(t(334))/7)+parseInt(t(338))/8*(-parseInt(t(321))/9)+-parseInt(t(318))/10)break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var n=function(){var t=_0x6a70;function _0x47c546(){this.PI=Math.PI,this.x_pi=3e3*Math.PI/180}return _0x47c546[t(306)][t(323)]=function(r,n){var a=t,e=6378245,i=.006693421622965943,s=this.transformLat(n-105,r-35),h=this[a(309)](n-105,r-35),o=r/180*this.PI,c=Math[a(320)](o);c=1-i*c*c;var u=Math[a(311)](c);return{lat:s=180*s/(6335552.717000426/(c*u)*this.PI),lon:h=180*h/(e/u*Math[a(315)](o)*this.PI)}},_0x47c546[t(306)][t(331)]=function(r,n){var a=t;if(this[a(326)](n,r))return[r,n];var e=this.delta(n,r);return[r+e[a(314)],n+e.lat]},_0x47c546[t(306)].gcj02_wgs84=function(r,n){var a=t;if(this[a(326)](n,r))return[r,n];var e=this[a(323)](n,r);return[r-e.lon,n-e[a(335)]]},_0x47c546[t(306)][t(322)]=function(r,n){var a=t,e=r,i=n,s=Math[a(311)](e*e+i*i)+2e-5*Math.sin(i*this.x_pi),h=Math[a(324)](i,e)+3e-6*Math[a(315)](e*this[a(329)]);return[s*Math[a(315)](h)+.0065,s*Math[a(320)](h)+.006]},_0x47c546[t(306)][t(333)]=function(r,n){var a=t,e=r-.0065,i=n-.006,s=Math[a(311)](e*e+i*i)-2e-5*Math[a(320)](i*this[a(329)]),h=Math.atan2(i,e)-3e-6*Math[a(315)](e*this[a(329)]);return[s*Math[a(315)](h),s*Math[a(320)](h)]},_0x47c546.prototype.wgs84_bd09ll=function(r,n){var a=t,e=this.wgs84_gcj02(r,n);return this[a(322)](e[0],e[1])},_0x47c546[t(306)].bd09ll_wgs84=function(r,n){var a=this[t(333)](r,n);return this.gcj02_wgs84(a[0],a[1])},_0x47c546.prototype.wgs84_mercator=function(r,n){var a=t,e=20037508.34*r/180,i=Math[a(312)](Math[a(330)]((90+n)*Math.PI/360))/(Math.PI/180);return[e,i=20037508.34*i/180]},_0x47c546[t(306)][t(327)]=function(r,n){var a=t,e=n/20037508.34*180;return[r/20037508.34*180,e=180/Math.PI*(2*Math[a(337)](Math[a(325)](e*Math.PI/180))-Math.PI/2)]},_0x47c546[t(306)][t(308)]=function(t){return t/180*Math.PI},_0x47c546[t(306)][t(332)]=function(t){return 180*t/Math.PI},_0x47c546.prototype.outOfChina=function(t,r){return r<72.004||r>137.8347||(t<.8293||t>55.8271)},_0x47c546[t(306)][t(319)]=function(r,n){var a=t,e=2*r-100+3*n+.2*n*n+.1*r*n+.2*Math[a(311)](Math[a(313)](r));return e+=2*(20*Math[a(320)](6*r*this.PI)+20*Math[a(320)](2*r*this.PI))/3,e+=2*(20*Math[a(320)](n*this.PI)+40*Math.sin(n/3*this.PI))/3,e+=2*(160*Math[a(320)](n/12*this.PI)+320*Math[a(320)](n*this.PI/30))/3},_0x47c546[t(306)][t(309)]=function(r,n){var a=t,e=300+r+2*n+.1*r*r+.1*r*n+.1*Math.sqrt(Math.abs(r));return e+=2*(20*Math.sin(6*r*this.PI)+20*Math[a(320)](2*r*this.PI))/3,e+=2*(20*Math[a(320)](r*this.PI)+40*Math[a(320)](r/3*this.PI))/3,e+=2*(150*Math.sin(r/12*this.PI)+300*Math[a(320)](r/30*this.PI))/3},_0x47c546}();function _0x6a70(t,r){var n=_0x2276();return(_0x6a70=function(t,r){return n[t-=306]})(t,r)}function _0x2276(){var t=["cos","243805JYxvFM","216824EQXDXm","15699640tnFSaC","transformLat","sin","5337sApecM","gcj02_bd09ll","delta","atan2","exp","outOfChina","mercator_wgs84","4xzwlZy","x_pi","tan","wgs84_gcj02","toDegrees","bd09ll_gcj02","3052WqKhtC","lat","7828690FApOrT","atan","11344jXsXVN","prototype","1407507Yxbrth","toRadians","transformLon","12552lfkhIG","sqrt","log","abs","lon"];return(_0x2276=function(){return t})()}function _0x2f94(t,r){var n=_0x1aeb();return(_0x2f94=function(t,r){return n[t-=485]})(t,r)}!function(){for(var t=_0x2f94,r=_0x1aeb();;)try{if(898255===parseInt(t(485))/1*(parseInt(t(496))/2)+parseInt(t(507))/3*(-parseInt(t(509))/4)+parseInt(t(506))/5*(-parseInt(t(493))/6)+-parseInt(t(487))/7+-parseInt(t(504))/8+parseInt(t(494))/9*(parseInt(t(505))/10)+parseInt(t(497))/11*(parseInt(t(502))/12))break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var a=function(){var t=_0x2f94;function _0x362ea2(){}return _0x362ea2[t(508)][t(488)]=function(){var r=t,n=[{"User-Agent":"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6"},{"User-Agent":"Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11"},{"User-Agent":"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"},{"User-Agent":r(499)},{"User-Agent":r(489)},{"User-Agent":r(490)},{"User-Agent":r(486)},{"User-Agent":r(498)},{"User-Agent":r(495)},{"User-Agent":r(500)},{"User-Agent":r(503)},{"User-Agent":"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11"},{"User-Agent":r(501)}],a=n[r(491)];return n[Math.round(Math[r(492)]()*(a-1))]},_0x362ea2}();function _0x1aeb(){var t=["random","6hlcbdC","81dzCAFT","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1","30uiAEFm","11wEpHdF","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0","Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1","Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11","17964348jcirev","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11","3853672xojpjm","1385530MBiplF","3158080bNcaDo","436485ozYPPl","prototype","28kSXuMQ","69501ZopNga","Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50","5295332UneQAC","GetRandomUserAgent","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/44.0.2403.89 Chrome/44.0.2403.89 Safari/537.36","Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50","length"];return(_0x1aeb=function(){return t})()}function _0x461f(t,r){var n=_0x47d9();return(_0x461f=function(t,r){return n[t-=425]})(t,r)}!function(){for(var t=_0x461f,r=_0x47d9();;)try{if(318305===parseInt(t(426))/1*(-parseInt(t(449))/2)+parseInt(t(429))/3+parseInt(t(447))/4+parseInt(t(436))/5+parseInt(t(442))/6+parseInt(t(446))/7*(-parseInt(t(448))/8)+parseInt(t(434))/9)break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var e=function(){var t=_0x461f;function _0x2ac502(){}return _0x2ac502[t(430)][t(431)]=function(r,n,a){var e=t,i=Math[e(428)](2,r),s=n/i,h=a/i,o=360*s-180,c=360*(s+1/i)-180,u=Math[e(441)](Math[e(440)](Math.PI*(1-2*h)))*(180/Math.PI);return[o,Math[e(441)](Math[e(440)](Math.PI*(1-2*(h+1/i))))*(180/Math.PI),c,u]},_0x2ac502[t(430)][t(444)]=function(r,n,a){var e=t,i=Math.pow(2,r),s=n/i,h=a/i,o=360*s-180,c=360*(s+1/i)-180,u=Math.atan(Math.sinh(Math.PI*(1-2*h)))*(180/Math.PI);return{min_x:o,min_y:Math.atan(Math[e(440)](Math.PI*(1-2*(h+1/i))))*(180/Math.PI),max_x:c,max_y:u}},_0x2ac502[t(430)][t(425)]=function(r,n,a){var e=180/(256*Math[t(428)](2,r-1));return[256*n*e-180,90-256*(a+1)*e,256*(n+1)*e-180,90-256*a*e]},_0x2ac502[t(430)][t(433)]=function(r,n){for(var a=t,e=r[0],i=r[1],s=r[2],h=r[3],o=this.latToTile(h,n),c=this.latToTile(i,n),u=this[a(443)](e,n),f=this[a(443)](s,n),_=(c-o+1)*(f-u+1),x=[],M=o;M<=c;M++)for(var p=u;p<=f;p++)x[a(437)]({level:n,row:M,column:p});return{total:_,tiles:x}},_0x2ac502[t(430)][t(438)]=function(r,n){for(var a=t,e=r[0],i=r[1],s=r[2],h=r[3],o=180/(256*Math[a(428)](2,n-1)),c=Math[a(439)]((e+180)/(256*o)),u=Math.floor((s+180)/(256*o)),f=Math[a(439)]((90-h)/(256*o)),_=Math[a(439)]((90-i)/(256*o)),x=[],M=c;M<=u;M++)for(var p=_;p>=f;p--)x[a(437)]({zoom:n,x:M,y:p});return x},_0x2ac502.prototype.setTileOffset=function(r,n,a,e){var i=t,s=e[i(432)](r[0],r[1]),h=e.wgs84_mercator(r[2],r[3]),o=e[i(445)](s[0]+n,s[1]+a),c=e[i(445)](h[0]+n,h[1]+a);return[o[0],o[1],c[0],c[1]]},_0x2ac502.prototype[t(435)]=function(r,n){var a=t,e=Math.pow(2,n),i=r*(Math.PI/180),s=Math.log(Math[a(427)](i/2+Math.PI/4));return Math[a(439)]((1-s/Math.PI)*e/2)},_0x2ac502.prototype[t(443)]=function(r,n){var a=t,e=Math[a(428)](2,n);return Math[a(439)]((r+180)/360*e)},_0x2ac502}();function _0x47d9(){var t=["24378bjSlZF","lonToTile","calc_tile_Extent","mercator_wgs84","1263976llqCaV","766524iQhdsc","8fpFqna","9524UbTKwF","calc_4490_tile_bounds","6krovAE","tan","pow","84516hZDAAc","prototype","calc_tile_bounds","wgs84_mercator","calc_extent_tiles","98415cVNXym","latToTile","1463220HNZpgk","push","get4490TileFor3857Extent","floor","sinh","atan"];return(_0x47d9=function(){return t})()}function _0x1bc4(){var t=["13677453jfqFCt","wgs_gcj","gcj_bd","4304736BxqHAZ","project","asinh","bd_wgs","2Ahgccf","max","10002895FvKWjz","10NAjOdu","sin","prototype","tan","wgs_bd","bind","pj_sinhpsi2tanphi","11879043uLWXac","355718mzKwvf","bounds","cos","2250280RZNwzN","sinh","bd_gcj","6iHrnQl","10KlPwio","_coord_diff","exp","atan2","atanh","sqrt","601053ttYwDK","gcj_wgs_exact","bd_wgs_exact","abs","gcj_wgs","pow","_exact_iter"];return(_0x1bc4=function(){return t})()}!function(){for(var t=_0x583f,r=_0x1bc4();;)try{if(761626===parseInt(t(242))/1+-parseInt(t(231))/2*(-parseInt(t(255))/3)+parseInt(t(245))/4*(-parseInt(t(234))/5)+parseInt(t(248))/6*(parseInt(t(233))/7)+-parseInt(t(227))/8+-parseInt(t(262))/9*(-parseInt(t(249))/10)+-parseInt(t(241))/11)break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var i=function(){var t=_0x583f;function _0x356f9f(){var t=_0x583f;this.A=6378206.4,this.E=.08227185422300326,this[t(243)]=[[20037725.5,-16095439.382927246],[-20037726.46909435,19488378.9859151]],this[t(256)]=this[t(261)](this[t(263)],this[t(259)]),this.bd_wgs_exact=this[t(261)](this[t(238)],this[t(230)]),this[t(247)]=this[t(247)].bind(this),this[t(264)]=this[t(264)][t(239)](this),this.gcj_wgs=this.gcj_wgs[t(239)](this),this[t(263)]=this[t(263)][t(239)](this),this.bd_wgs=this[t(230)][t(239)](this),this[t(238)]=this[t(238)][t(239)](this),this[t(256)]=this[t(261)](this[t(263)],this[t(259)])[t(239)](this),this.bd_wgs_exact=this._exact_iter(this.wgs_bd,this[t(230)]).bind(this),this[t(250)]=this[t(250)][t(239)](this)}return _0x356f9f[t(236)][t(228)]=function(r,n){var a=t,e=this.wgs_bd(r,n),i=e[0],s=e[1],h=i*Math.PI/180*this.A,o=s*Math.PI/180;return[h,(Math[a(229)](Math[a(237)](o))-this.E*Math[a(253)](this.E*Math.sin(o)))*this.A]},_0x356f9f.prototype.unproject=function(r,n){var a=t,e=r/Math.PI*180/this.A,i=Math.atan(this[a(240)](Math[a(246)](n/this.A),this.E))/Math.PI*180;return this[a(257)](e,i)},_0x356f9f[t(236)][t(263)]=function(r,n){var a=t;if(!(n>=.8293&&n<=55.8271&&r>=72.004&&r<=137.8347))return[r,n];var e=6378245,i=.006693421622965943,s=r-105,h=n-35,o=s*Math.PI,c=h*Math.PI,u=Math.sqrt(Math[a(258)](s)),f=2*s-100+3*h+.2*h*h+.1*s*h+.2*u+20*(2*Math.sin(6*o)+2*Math[a(235)](2*o)+2*Math[a(235)](c)+4*Math[a(235)](c/3)+16*Math[a(235)](c/12)+32*Math[a(235)](c/30))/3,_=300+s+2*h+.1*s*s+.1*s*h+.1*u+20*(2*Math[a(235)](6*o)+2*Math[a(235)](2*o)+2*Math[a(235)](o)+4*Math.sin(o/3)+15*Math[a(235)](o/12)+30*Math[a(235)](o/30))/3,x=Math.PI/180,M=n*x,p=1-i*Math[a(260)](Math[a(235)](M),2),l=6335552.717000426*x/Math.pow(p,1.5);return[r+_/(x*(e*Math[a(244)](M)/Math.sqrt(p))),n+f/l]},_0x356f9f.prototype[t(264)]=function(r,n){var a=t,e=r,i=n,s=Math[a(254)](e*e+i*i)+2e-5*Math[a(235)](i*Math.PI*3e3/180),h=Math[a(252)](i,e)+3e-6*Math[a(244)](e*Math.PI*3e3/180);return[s*Math.cos(h)+.0065,s*Math.sin(h)+.006]},_0x356f9f[t(236)][t(247)]=function(r,n){var a=t,e=r-.0065,i=n-.006,s=Math[a(254)](e*e+i*i)-2e-5*Math.sin(i*Math.PI*3e3/180),h=Math[a(252)](i,e)-3e-6*Math[a(244)](e*Math.PI*3e3/180);return[s*Math[a(244)](h),s*Math[a(235)](h)]},_0x356f9f[t(236)][t(259)]=function(r,n){var a=t;return n>=.83056&&n<=55.8296&&r>=72.0077&&r<=137.8437?this._coord_diff([r,n],this[a(250)](this[a(263)](r,n),[r,n])):[r,n]},_0x356f9f.prototype[t(230)]=function(r,n){var a=t;if(!(n>=.83676&&n<=55.8355&&r>=72.0142&&r<=137.8503))return[r,n];var e=this[a(247)](r,n),i=e[0],s=e[1];return this[a(259)](i,s)},_0x356f9f[t(236)][t(238)]=function(r,n){var a=t,e=this[a(263)](r,n),i=e[0],s=e[1];return this[a(264)](i,s)},_0x356f9f[t(236)][t(250)]=function(t,r){var n=t[0],a=t[1];return[n-r[0],a-r[1]]},_0x356f9f[t(236)][t(261)]=function(r,n){var a=this;return function(t,e){for(var i=_0x583f,s=n(t,e),h=[1/0,1/0],o=0;Math[i(232)](Math[i(258)](h[1]),Math[i(258)](h[0]))>1e-6&&o<8;o++)h=a[i(250)](r(s[0],s[1]),[t,e]),s=a._coord_diff(s,h);return s}[t(239)](this)},_0x356f9f[t(236)].pj_sinhpsi2tanphi=function(r,n){var a=t,e=Math[a(254)](1e-15),i=2/e,s=1-n*n,h=e/10*Math[a(232)](1,Math.abs(r)),o=Math[a(258)](r)>70?r*Math[a(251)](n*Math.atanh(n)):r/s;if(!(Math[a(258)](o)<i))return o;for(var c=5;c-- >0;){var u=Math.sqrt(1+o*o),f=Math[a(246)](n*Math.atanh(n*o/u)),_=Math[a(254)](1+f*f)*o-f*u,x=(r-_)*(1+s*(o*o))/(s*u*Math[a(254)](1+_*_));if(o+=x,!(Math[a(258)](x)>=h))break}return o},_0x356f9f}();function _0x583f(t,r){var n=_0x1bc4();return(_0x583f=function(t,r){return n[t-=227]})(t,r)}function _0x2772(t,r){var n=_0x30c1();return(_0x2772=function(t,r){return n[t-=304]})(t,r)}function _0x30c1(){var t=["origin","getBaiduTilePrjSE","LatLng2Mercator","502485Qxhrdd","tileX","getTilePrjSE","35692677hgyFnU","Lat","10nQztIH","1016501fTKGkc","array3","height","getTilePrjExtent","xmin","getTilePrjNW","8WmohIY","7713489YZUzyc","abs","array2","scale","2954630kDewes","ToExtent","492952JrtyHc","xmax","getBaiduTilePrjNW","6852240YEKUDL","array1","pow","array4","ymin","prototype","Lng","width","length","ymax"];return(_0x30c1=function(){return t})()}!function(){for(var t=_0x2772,r=_0x30c1();;)try{if(847101===parseInt(t(324))/1+-parseInt(t(335))/2+-parseInt(t(318))/3+-parseInt(t(337))/4*(parseInt(t(323))/5)+-parseInt(t(305))/6+-parseInt(t(331))/7*(parseInt(t(330))/8)+parseInt(t(321))/9)break;r.push(r.shift())}catch(t){r.push(r.shift())}}();var s=function(){var t=_0x2772;function _0x1e3bc5(){var t=_0x2772;this[t(306)]=[75,60,45,30,15,0],this[t(325)]=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this[t(333)]=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this.array4=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]]}return _0x1e3bc5.prototype[t(317)]=function(r){var n=t,a=null;r[n(322)]>74||r.Lat;for(var e=0;e<this[n(306)][n(313)];e++)if(r[n(322)]>=this[n(306)][e]){a=this[n(333)][e];break}if(null===a)for(e=this[n(306)][n(313)]-1;e>=0;e--)if(r.Lat<=-this.array1[e]){a=this[n(333)][e];break}var i=this.Convertor(r[n(311)],r[n(322)],a);return{X:i[0],Y:i[1]}},_0x1e3bc5.prototype.Mercator2LatLng=function(r){for(var n=t,a=null,e={X:Math[n(332)](r.X),Y:Math[n(332)](r.Y)},i=0;i<this.array3[n(313)];i++)if(e.Y>=this[n(325)][i]){a=this[n(308)][i];break}var s=this.Convertor(e.X,e.Y,a);return{Lng:s[0],Lat:s[1]}},_0x1e3bc5[t(310)].Convertor=function(r,n,a){var e=t,i=a[0]+a[1]*Math.abs(r),s=Math[e(332)](n)/a[9],h=[i,a[2]+a[3]*s+a[4]*s*s+a[5]*s*s*s+a[6]*s*s*s*s+a[7]*s*s*s*s*s+a[8]*s*s*s*s*s*s];return h[0]*=r<0?-1:1,h[1]*=n<0?-1:1,h},_0x1e3bc5.prototype.getBaiduTilePrjBounds=function(r,n){var a=t,e=Math.pow(2,18-n);return this[a(327)](r[a(319)],r.tileY,e)},_0x1e3bc5[t(310)][t(304)]=function(r,n){var a=t,e=Math[a(307)](2,18-n);return this[a(329)](r[a(319)],r.tileY,e,{scale:{x:1,y:1},origin:{x:0,y:0}},{width:256,height:256},1,1)},_0x1e3bc5[t(310)][t(316)]=function(r,n){var a=t,e=Math[a(307)](2,18-n);return this.getTilePrjSE(r[a(319)],r.tileY,e,{scale:{x:1,y:1},origin:{x:0,y:0}},{width:256,height:256},1,1)},_0x1e3bc5[t(310)][t(327)]=function(r,n,a){var e=t,i={scale:{x:1,y:1},origin:{x:0,y:0}},s={width:256,height:256},h=this[e(329)](r,n,a,i,s,1,1),o=this[e(320)](r,n,a,i,s,1,1);return this[e(336)](h,o)},_0x1e3bc5[t(310)][t(329)]=function(r,n,a,e,i,s,h){var o=t,c=e[o(315)].y+h*e[o(334)].y*(n+(1===e[o(334)].y?1:0))*a*i.height;return{x:e[o(315)].x+s*e.scale.x*(r+(1===e[o(334)].x?0:1))*a*i[o(312)],y:c}},_0x1e3bc5.prototype.getTilePrjSE=function(r,n,a,e,i,s,h){var o=t,c=e[o(315)].y+h*e[o(334)].y*(n+(1===e[o(334)].y?0:1))*a*i[o(326)];return{x:e[o(315)].x+s*e[o(334)].x*(r+(1===e.scale.x?1:0))*a*i[o(312)],y:c}},_0x1e3bc5[t(310)][t(336)]=function(r,n){var a=t,e={xmax:0,xmin:0,ymax:0,ymin:0};return r.x>n.x?(e[a(328)]=n.x,e[a(338)]=r.x):(e[a(328)]=r.x,e[a(338)]=n.x),r.y>n.y?(e[a(309)]=n.y,e[a(314)]=r.y):(e[a(309)]=r.y,e[a(314)]=n.y),e},_0x1e3bc5}();function _0x31ae(){var t=["6337107cYhIFx","80Brwjiz","40ogVmIB","1233870xCRfbT","471tMsznr","175098rMMAXu","504GdEgNE","207LRZIdj","133720QTsTLk","6107814RBTzNc","186740yGnsEm"];return(_0x31ae=function(){return t})()}function _0x4949(t,r){var n=_0x31ae();return(_0x4949=function(t,r){return n[t-=211]})(t,r)}!function(){for(var t=_0x4949,r=_0x31ae();;)try{if(521469===parseInt(t(214))/1*(-parseInt(t(216))/2)+-parseInt(t(215))/3+parseInt(t(211))/4*(parseInt(t(220))/5)+-parseInt(t(219))/6+parseInt(t(221))/7+parseInt(t(218))/8*(-parseInt(t(217))/9)+parseInt(t(212))/10*(parseInt(t(213))/11))break;r.push(r.shift())}catch(t){r.push(r.shift())}}(),exports.BaiDuMercator=i,exports.BaiDuProjUtils=s,exports.CoordinateTransformer=n,exports.GeodeticMapTileCalcUtils=r,exports.MercatorMapTileCalcUtils=t,exports.TileCalcUtils=e,exports.UserAgent=a;
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "map-tile-utils",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "dist/map-tile-utils.js",
6
+ "files": [
7
+ "dist/map-tile-utils.js"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rimraf dist",
11
+ "build": "npm run clean && rollup -c",
12
+ "test": "jest"
13
+ },
14
+ "keywords": [],
15
+ "author": "luothink",
16
+ "license": "ISC",
17
+ "description": "",
18
+ "devDependencies": {
19
+ "@rollup/plugin-commonjs": "^28.0.1",
20
+ "@rollup/plugin-node-resolve": "^15.3.0",
21
+ "@rollup/plugin-terser": "^0.4.4",
22
+ "@types/jest": "^29.5.14",
23
+ "rollup": "^4.28.1",
24
+ "rollup-plugin-obfuscator": "^1.1.0",
25
+ "rollup-plugin-typescript2": "^0.36.0",
26
+ "ts-jest": "^29.2.5",
27
+ "typescript": "^5.7.2"
28
+ },
29
+ "jest": {
30
+ "preset": "ts-jest",
31
+ "testEnvironment": "node"
32
+ },
33
+ "dependencies": {
34
+ "@rollup/plugin-alias": "^5.1.1",
35
+ "@rollup/plugin-babel": "^6.0.4",
36
+ "@rollup/plugin-json": "^6.1.0",
37
+ "@rollup/plugin-typescript": "^12.1.1"
38
+ }
39
+ }