text: ﻿/**  
   * 提供了百度坐标（BD09）、国测局坐标（GCJ02）、WGS84坐标系、Web墨卡托 4类坐标之间的转换
   *  Created by 木遥（QQ：346819890）  
   *  传入参数 和 返回结果 均是数组：[经度,纬度] 
   */
  (function (a, b) { if (typeof define === "function" && define.amd) { define([], b) } else { if (typeof module === "object" && module.exports) { module.exports = b() } else { a.pointconvert = b() } } }(this, function () { var b = 3.141592653589793 * 3000 / 180; var p = 3.141592653589793; var m = 6378245; var g = 0.006693421622965943; var k = function k(a) { var v = Number(a[0]); var r = Number(a[1]); var B = 3.141592653589793 * 3000 / 180; var A = v - 0.0065; var w = r - 0.006; var u = Math.sqrt(A * A + w * w) - 0.00002 * Math.sin(w * B); var q = Math.atan2(w, A) - 0.000003 * Math.cos(A * B); var t = u * Math.cos(q); var s = u * Math.sin(q); t = Number(t.toFixed(6)); s = Number(s.toFixed(6)); return [t, s] }; var l = function l(s) { var q = Number(s[0]); var u = Number(s[1]); var v = Math.sqrt(q * q + u * u) + 0.00002 * Math.sin(u * b); var r = Math.atan2(u, q) + 0.000003 * Math.cos(q * b); var a = v * Math.cos(r) + 0.0065; var t = v * Math.sin(r) + 0.006; a = Number(a.toFixed(6)); t = Number(t.toFixed(6)); return [a, t] }; var d = function d(a) { var x = Number(a[0]); var w = Number(a[1]); if (e(x, w)) { return [x, w] } else { var t = f(x - 105, w - 35); var v = i(x - 105, w - 35); var q = w / 180 * p; var y = Math.sin(q); y = 1 - g * y * y; var u = Math.sqrt(y); t = (t * 180) / ((m * (1 - g)) / (y * u) * p); v = (v * 180) / (m / u * Math.cos(q) * p); var r = w + t; var s = x + v; s = Number(s.toFixed(6)); r = Number(r.toFixed(6)); return [s, r] } }; var n = function n(a) { var w = Number(a[0]); var v = Number(a[1]); if (e(w, v)) { return [w, v] } else { var s = f(w - 105, v - 35); var u = i(w - 105, v - 35); var q = v / 180 * p; var y = Math.sin(q); y = 1 - g * y * y; var t = Math.sqrt(y); s = (s * 180) / ((m * (1 - g)) / (y * t) * p); u = (u * 180) / (m / t * Math.cos(q) * p); mglat = v + s; mglng = w + u; var x = w * 2 - mglng; var r = v * 2 - mglat; x = Number(x.toFixed(6)); r = Number(r.toFixed(6)); return [x, r] } }; var c = function c(a) { return n(k(a)) }; var o = function o(a) { return l(d(a)) }; var f = function f(q, r) { var a = -100 + 2 * q + 3 * r + 0.2 * r * r + 0.1 * q * r + 0.2 * Math.sqrt(Math.abs(q)); a += (20 * Math.sin(6 * q * p) + 20 * Math.sin(2 * q * p)) * 2 / 3; a += (20 * Math.sin(r * p) + 40 * Math.sin(r / 3 * p)) * 2 / 3; a += (160 * Math.sin(r / 12 * p) + 320 * Math.sin(r * p / 30)) * 2 / 3; return a }; var i = function i(q, r) { var a = 300 + q + 2 * r + 0.1 * q * q + 0.1 * q * r + 0.1 * Math.sqrt(Math.abs(q)); a += (20 * Math.sin(6 * q * p) + 20 * Math.sin(2 * q * p)) * 2 / 3; a += (20 * Math.sin(q * p) + 40 * Math.sin(q / 3 * p)) * 2 / 3; a += (150 * Math.sin(q / 12 * p) + 300 * Math.sin(q / 30 * p)) * 2 / 3; return a }; var e = function e(a, q) { return (a < 72.004 || a > 137.8347) || ((q < 0.8293 || q > 55.8271) || false) }; var h = function h(r) { var q = Number(r[0]); var s = Number(r[1]); var a = q * 20037508.34 / 180; var t = Math.log(Math.tan((90 + s) * p / 360)) / (p / 180); t = t * 20037508.34 / 180; a = Number(a.toFixed(2)); t = Number(t.toFixed(2)); return [a, t] }; var j = function j(r) { var q = Number(r[0]); var s = Number(r[1]); var a = q / 20037508.34 * 180; var t = s / 20037508.34 * 180; t = 180 / p * (2 * Math.atan(Math.exp(t * p / 180)) - p / 2); a = Number(a.toFixed(6)); t = Number(t.toFixed(6)); return [a, t] }; return { jwd2mct: h, mct2jwd: j, bd2gcj: k, gcj2bd: l, bd2wgs: c, wgs2bd: o, wgs2gcj: d, gcj2wgs: n } }));