带有我家图像的经纬度映射
我有我的房子的顶视图图像,并且知道左上角像素的纬度经度,即 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 的纬度经度并从中导出其他值
I have top view image of my house and know lat longitude for left top pixel i.e 0,0 now how to get latitude longitude values of other pixels?
While googling i came across following:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要知道像素之间的距离。要将距离转换为度数,您可以使用一海分钟(1/60 度)纬度为 1,852 米或约 6076 英尺这一事实。赤道处的经度相同,但其他地方需要乘以纬度的余弦。
一度纬度 = 1852 米
一度经度 = 1852 米 * cos(latitude)
(您可能需要将纬度乘以 pi/180,以将其转换为余弦函数的弧度。)
You need to know the distance between pixels. To convert distance to degrees, you can use the fact that one nautical minute (1/60 of a degree) latitude is 1,852 meters or about 6076 feet. The longitude is the same at the equator, but you need to multiply by the cosine of the latitude elsewhere.
One degree latitude = 1852 meters
One degree longitude = 1852 meters * cos(latitude)
(You might need to multiply the degrees latitude by pi/180 to convert them to radians for the cosine function.)