According to links provided by Andre Joost
, I found the translation. And this is the projection for google.maps:
function MProjection() {
}
MProjection.prototype.fromLatLngToPoint = function(latlng) {
var x = (latlng.lng() + 180) / 360 * 256;
var y = ((1 - Math.log(Math.tan(latlng.lat() * Math.PI / 180) + 1 / Math.cos(latlng.lat() * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, 0)) * 256;
return new google.maps.Point(x, y);
};
MProjection.prototype.fromPointToLatLng = function(point) {
var lng = point.x / 256 * 360 - 180;
var n = Math.PI - 2 * Math.PI * point.y / 256;
var lat = (180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n))));
return new google.maps.LatLng(lat, lng);
};
The 256
means the tileSize.