【问题标题】:Convert x,y position to LLA in decimal degree将 x,y 位置转换为十进制度数的 LLA
【发布时间】:2022-07-30 01:43:31
【问题描述】:
我正在尝试将地图图块上的像素位置 (x,y) 转换为经度、纬度、高度 (LLA) 格式(十进制度)。我有一张谷歌地球夜间在西班牙上空的地图。我有所有四个角的 LLA,我想知道 x:657、y:81 处像素的 LLA 位置
我如何知道要使用哪种地图投影?是否有一种简单的方法可以计算此图像中每个像素的 LLA 位置?是否可以将相同的方法应用于来自 google earth 的不同地图图块?
我正在尝试在 python 或 matlab 上开发这种转换
谢谢
【问题讨论】:
标签:
python
location
latitude-longitude
google-earth
satellite
【解决方案1】:
我确信有一个更好的解决方案,我对 python 还很陌生,但是如果我正在寻找给定像素位置的经度和纬度,我会开始考虑如何接近它。 *如果这不是您想要的,我很抱歉,我可能误解了。
# image size in pixels
img_size = [807, 152]
# Pixel position
px_pos = (225, 35)
def calc_lla(top_r_lat, top_r_long, bottom_l_lat, bottom_l_long, map_size, pos):
# Taking the latitude of the upper right corner and bottom left, subtracting them, dividing the difference by map size in pixels, then multiplying that with the position given
lat = top_r_lat - (((top_r_lat - bottom_l_lat) / map_size[0]) * pos[0])
# same as above for longitude
long = top_r_long - (((top_r_long - bottom_l_long) / map_size[1]) * pos[1])
return (lat, long)
print(calc_lla(44.372321, -7.904955, 40.801188, -3.088944, img_size, px_pos))
# Returns (43.37665194795539, -6.79600509868421)
【解决方案2】:
由于您从 Google 地球中获取图像,因此您应该能够在 Google 地球中直接获取 lat/lon/alt。只需将鼠标悬停在所需位置的图像上,然后从状态栏中读取值。