【发布时间】:2011-05-13 11:08:55
【问题描述】:
我有我家的顶视图图像并且知道左上像素的纬度经度,即 0,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);
}
半径 = 6371 公里地球半径.. 但是如果我通过 0,0 我会得到 0,0 如何修复 0,0 的纬度经度并从中派生其他值
【问题讨论】: