我有我家的顶视图图像并知道左上角像素的纬度经度,即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 km地球半径.. 但是如果我通过0,0我得到0,0如何修正0,0的纬度经度并从中得出其他值
答案 0 :(得分:1)
你需要知道像素之间的距离。要将距离转换为度数,您可以使用一个航海分钟(1/60度)纬度为1,852米或约6076英尺的事实。赤道的经度是相同的,但你需要乘以其他地方的纬度余弦。
一度纬度= 1852米
一度经度= 1852米* cos(纬度)
(您可能需要将纬度度乘以pi / 180,将其转换为余弦函数的弧度。)