Creating primary keyvar LLBAND2 = [75, 60, 45, 30, 15, 0]; var LL2MC2 = [[-.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]]; function convertorLng(lng, cN) { var T = cN[0] + cN[1] * Math.abs(lng); T *= (lng < 0 ? -1 : 1); return T; }; function convertorLat(lat, cN) { var cL = Math.abs(lat) / cN[9]; var cO = cN[2] + cN[3] * cL + cN[4] * cL * cL + cN[5] * cL * cL * cL + cN[6] * cL * cL * cL * cL + cN[7] * cL * cL * cL * cL * cL + cN[8] * cL * cL * cL * cL * cL * cL; cO *= (lat < 0 ? -1 : 1); return cO; }; function convertorLat2(lat, b) { d = Math.abs(lat) / b[9]; d = b[2] + b[3] * d + b[4] * d * d + b[5] * d * d * d + b[6] * d * d * d * d + b[7] * d * d * d * d * d + b[8] * d * d * d * d * d * d; d = d * (0 > lat ? -1 :1); return d; }; function aa(lng2, lat2, c3) { //debugger; //var c3 = 18; var c1 = 256; //var lng = 12684092.41; //var lat = 2559234.49; var cL = -180; var T = 180; while (lng2 > T) { lng2 -= T - cL } while (cM < cL) { lng2 += T - cL } lat2 = Math.max(lat2, -74) lat2 = Math.min(lat2, 74) var cN; for (var cM = 0; cM < LLBAND2.length; cM++) { if (lat2 >= this.LLBAND2[cM]) { cN = this.LL2MC2[cM]; break; } } if (!cN) { for (var cM = LLBAND2.length - 1; cM >= 0; cM--) { if (lat2 <= -LLBAND2[cM]) { cN = LL2MC2[cM]; break } } } var lng = convertorLng(lng2, cN); var lat = convertorLat(lat2, cN); var cU = Math.pow(2, (18 - c3)); var cX = Math.pow(2, (18 - c3)) * c1; var cV = Math.ceil(lng / cX); var cQ = Math.ceil(lat / cX); var cO = [cV, cQ, (lng - cV * cX) / cX * c1, (lat - cQ * cX) / cX * c1]; var width = 0; var height = 0; var db = cO[0] - Math.ceil((width / 2 - cO[2]) / c1); var cN2 = cO[1] - Math.ceil((height / 2 - cO[3]) / c1); alert('http://online2.map.bdimg.com/tile/?qt=tile&x=' + db + '&y=' + cN2 + '&z=' + c3 + '&styles=pl&udt=20140314'); return }