var sin = Math.sin, cos = Math.cos, atan2 = Math.atan2, sqrt = Math.sqrt, PI = Math.PI;
var baiduFactor = PI * 3000.0 / 180.0;
export function BD09ToGCJ02(coord) {
    var lon = coord[0], lat = coord[1];
    var x = lon - 0.0065;
    var y = lat - 0.006;
    var z = sqrt(x * x + y * y) - 0.00002 * sin(y * baiduFactor);
    var theta = atan2(y, x) - 0.000003 * cos(x * baiduFactor);
    var newLon = z * cos(theta);
    var newLat = z * sin(theta);
    return [newLon, newLat];
}
export function GCJ02ToBD09(coord) {
    var lon = coord[0], lat = coord[1];
    var x = lon;
    var y = lat;
    var z = sqrt(x * x + y * y) + 0.00002 * sin(y * baiduFactor);
    var theta = atan2(y, x) + 0.000003 * cos(x * baiduFactor);
    var newLon = z * cos(theta) + 0.0065;
    var newLat = z * sin(theta) + 0.006;
    return [newLon, newLat];
}
