日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

大地坐标系和空间直角坐标系的转换

發布時間:2023/12/13 综合教程 26 生活家
生活随笔 收集整理的這篇文章主要介紹了 大地坐标系和空间直角坐标系的转换 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

大地坐標系轉空間直角坐標系

import math
A_ALIS = 6378137
B_ALIS = 6356752.3142

E = math.sqrt(A_ALIS * A_ALIS - B_ALIS * B_ALIS) / A_ALIS

def transform_latlonhei2xyz(lon, lat, h):
    """ 大地坐標系 轉 空間直角坐標系 """
    lon, lat, h = math.radians(float(lon)), math.radians(float(lat)), float(h)

    W = math.sqrt(1 - E * E * math.sin(lat) * math.sin(lat))
    N = A_ALIS / W

    x = (N + h) * math.cos(lat) * math.cos(lon)
    y = (N + h) * math.cos(lat) * math.sin(lon)
    z = (N * (1 - E * E) + h) * math.sin(lat)

    return x, y, z

print(transform_latlonhei2xyz(lon=121.4533008922, lat=31.1720088176, h=15.069))
# (-2850172.518796192, 4659579.331978275, 3282233.397176004)

  空間直角坐標系轉大地坐標系

import math
A_ALIS = 6378137
B_ALIS = 6356752.3142

E2 = (A_ALIS * A_ALIS - B_ALIS * B_ALIS) / (B_ALIS * B_ALIS)

def transform_xyz2lonlathei(x, y, z):
    lon = math.degrees(math.atan2(y, x))

    S = math.atan2(z * A_ALIS, math.sqrt(x * x + y * y) * B_ALIS)

    lat = math.atan2(z + E2 * B_ALIS * math.pow(math.sin(S), 3),
                     (math.sqrt(x * x + y * y) - E * E * A_ALIS * math.pow(math.cos(S), 3)))

    W = math.sqrt(1 - E * E * math.sin(lat) * math.sin(lat))
    N = A_ALIS / W
    hei = math.sqrt(x * x + y * y) / math.cos(lat) - N

    lat = math.degrees(lat)
    return lon, lat, hei


    print(transform_xyz2lonlathei(x=-2850172.518796192, y=4659579.331978275, z=3282233.397176004))
#(121.4533008922, 31.1720088176, 15.06900000013411)

總結

以上是生活随笔為你收集整理的大地坐标系和空间直角坐标系的转换的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。