123456 |
- /*!
- Author: hiwanz
- Source: https://github.com/hiwanz/wgs2mars.js.git
- Date: 2017-04-13 18:22:45
- */
- !function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.transformFromWGSToGCJ=b()}(this,function(){function a(a,b,c,d){this.west=Math.min(a,c),this.north=Math.max(b,d),this.east=Math.max(a,c),this.south=Math.min(b,d)}function b(a,b,c){return a.west<=b&&a.east>=b&&a.north>=c&&a.south<=c}function c(a,c){for(var d=0;d<j.length;d++)if(b(j[d],a,c)){for(var e=0;e<k.length;e++)if(b(k[e],a,c))return!1;return!0}return!1}function d(a,b){var c=-100+2*a+3*b+.2*b*b+.1*a*b+.2*Math.sqrt(Math.abs(a));return c+=2*(20*Math.sin(6*a*g)+20*Math.sin(2*a*g))/3,c+=2*(20*Math.sin(b*g)+40*Math.sin(b/3*g))/3,c+=2*(160*Math.sin(b/12*g)+320*Math.sin(b*g/30))/3}function e(a,b){var c=300+a+2*b+.1*a*a+.1*a*b+.1*Math.sqrt(Math.abs(a));return c+=2*(20*Math.sin(6*a*g)+20*Math.sin(2*a*g))/3,c+=2*(20*Math.sin(a*g)+40*Math.sin(a/3*g))/3,c+=2*(150*Math.sin(a/12*g)+300*Math.sin(a/30*g))/3}function f(a,b){var f={};if(!c(a,b))return f={lat:b,lng:a};var j=d(a-105,b-35),k=e(a-105,b-35),l=b/180*g,m=Math.sin(l);m=1-i*m*m;var n=Math.sqrt(m);return j=180*j/(h*(1-i)/(m*n)*g),k=180*k/(h/n*Math.cos(l)*g),f={lat:b+j,lng:a+k}}var g=3.141592653589793,h=6378245,i=.006693421622965943,j=[new a(79.4462,49.2204,96.33,42.8899),new a(109.6872,54.1415,135.0002,39.3742),new a(73.1246,42.8899,124.143255,29.5297),new a(82.9684,29.5297,97.0352,26.7186),new a(97.0253,29.5297,124.367395,20.414096),new a(107.975793,20.414096,111.744104,17.871542)],k=[new a(119.921265,25.398623,122.497559,21.785006),new a(101.8652,22.284,106.665,20.0988),new a(106.4525,21.5422,108.051,20.4878),new a(109.0323,55.8175,119.127,50.3257),new a(127.4568,55.8175,137.0227,49.5574),new a(131.2662,44.8922,137.0227,42.5692),new a(113.837108,22.44151,114.408397,22.167709)];return f});
|