Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion javascript/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions javascript/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down