diff --git a/javascript/test.js b/javascript/test.js index f265d21..8216b39 100644 --- a/javascript/test.js +++ b/javascript/test.js @@ -44,7 +44,7 @@ for (var i = 0; i < tests.length; i++) { var wgs = transform.gcj2wgs_exact(gcjLat, gcjLng); var d = transform.distance(wgs.lat, wgs.lng, tests[i][0], tests[i][1]); if (d > 0.5) { - console.log("gcj2wgs_exact test " + i + ": distance" + d); + console.error("gcj2wgs_exact test " + i + ": distance" + d); } } diff --git a/javascript/transform.js b/javascript/transform.js index 3340d98..ab5e1ab 100644 --- a/javascript/transform.js +++ b/javascript/transform.js @@ -87,8 +87,8 @@ function gcj2wgs_exact(gcjLat, gcjLng) { // newCoord = gcjCoord - wgs_to_gcj_delta(newCoord) var tmp = wgs2gcj(newLat, newLng); // approx difference using gcj-space difference - newLat -= gcjLat - tmp.lat; - newLng -= gcjLng - tmp.lng; + newLat += gcjLat - tmp.lat; + newLng += gcjLng - tmp.lng; // diffchk if (Math.max(Math.abs(oldLat - newLat), Math.abs(oldLng - newLng)) < threshold) { break;