我对我的房屋有最强的印象,并且知道左上层的ix子,即现在的0,如何获得其他食谱的纬度长度值?
虽然大毛派有:
function longToX(longitudeDegrees)
{
var longitude =degreesToRadians(longitudeDegrees);
return (radius * longitude);
}
function latToY(latitudeDegrees)
{
var latitude =degreesToRadians(latitudeDegrees);
var newy = radius/2.0 *
Math.log( (1.0 + Math.sin(latitude)) /
(1.0 - Math.sin(latitude)) );
return newy;
}
function xToLong(xx)
{
var longRadians = xx/radius;
var longDegrees = radiansToDegrees(longRadians);
/* The user could have panned around the world a lot of times.
Lat long goes from -180 to 180. So every time a user gets
to 181 we want to subtract 360 degrees. Every time a user
gets to -181 we want to add 360 degrees. */
var rotations = Math.floor((longDegrees + 180)/360)
var longitude = longDegrees - (rotations * 360)
return longitude;
}
function yToLat(yo)
{
var latitude = (Math.PI/2) -
(2 * Math.atan(
Math.exp(-1.0 * yo / radius)));
return radiansToDegrees(latitude);
}
radius = 6371 km radius of earth.. but however if i pass 0,0 i get 0,0 how to fix latitude longitude for 0,0 and derive from it other values