[ Cesium ] 根据 TLE 生成 czml 的三种方式

2023-05-16

文章目录

    • 一.使用 python tle2czml 库生成
    • 二.手动爬虫
    • 三.使用 python requests 库获取
    • 四.备注

一.使用 python tle2czml 库生成

import tle2czml

tles = '''BEIDOU 2     
1 31115U 07011A   21323.16884980 -.00000043  00000-0  00000-0 0  9993
2 31115  51.9034 274.7604 0003928 314.2233  45.7206  1.77349177 46511
BEIDOU 3
1 36287U 10001A   21323.54986160 -.00000268  00000-0  00000-0 0  9995
2 36287   1.7347  43.1625 0001966  74.6398 279.3247  1.00266671 43404'''
czml = tle2czml.tles_to_czml(tles)
print(czml)
fo = open("test.czml", "w")
fo.write(czml)
fo.close()

二.手动爬虫

  • 网站:http://www.orbitalpredictor.com/home/
  • Add Satellite 输入框:中粘贴 TLE 数据
  • 复制响应信息 data.czml 里的 json 信息保存到本地即可

三.使用 python requests 库获取

  • sats 参数是指卫星的编号
import requests

url = "http://www.orbitalpredictor.com/api/predict_orbit"
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"}

kw = {'sats': '39159,39634',
      'start': '2018-02-26_15:00:00',
      'end': '2018-02-27_15:00:00',
      'format': 'czml',
      'type': 'orbit'
      }
response = requests.get(url, headers=headers, params=kw)

# print(response.url)
# print(response.status_code)
# print(response.json())
print(response.text)
fo = open("39159.czml", "w")
fo.write(response.text)
fo.close()

四.备注

  • 获取 卫星编号 或者 TLE 数据
  • https://www.space-track.org/auth/login
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

[ Cesium ] 根据 TLE 生成 czml 的三种方式 的相关文章

随机推荐