【小沐杂货铺】基于Three.JS绘制卫星轨迹Satellite(GIS 、WebGL、vue、react,提供全部源代码)
Three.js 是一个基于 WebGL 的 JavaScript 3D 图形库,能够简化浏览器中复杂 3D 场景和动画的开发。Satellite.js 是一个专注于卫星轨道计算的 JavaScript 工具库,基于 SGP4/SDP4 模型实现卫星位置与速度的预测。它通过解析 TLE(两行轨道根数)数据,支持低地球轨道(LEO)和中地球轨道(MEO)卫星的实时跟踪与轨迹模拟,常用于航天工程、天文
| 🍺AI系列相关文章🍺: | |
|---|---|
| 1 | 【小沐学AI】基于AI大模型开发MCP Server服务(Cesium.JS、Three.JS、Blender) |
文章目录
- 1、简介
- 2、测试代码(Three.JS)
-
- A3_1_ThreeJS_Satellite_js
- A3_2_ThreeJS_Satellite_js
- A3_3_ThreeJS_Satellite_js_tle
- A3_4_ThreeJS_Satellite_js_tle
- A3_5_ThreeJS_Satellite_js_tle_python
- A3_6_ThreeJS_Satellite_js_tle
- A3_7_ThreeJS_Satellite_js_tle
- A3_8_ThreeJS_Satellite_js_tle
- A3_9_ThreeJS_Satellite_js_react_tle
- A3_10_ThreeJS_Satellite_js_tle
- A3_11_ThreeJS_Satellite_jsx_react_vite_tle
- A3_12_ThreeJS_Satellite_js_tle_editor_3d
- A3_13_ThreeJS_Satellite_js_six_editor_2d
- A3_14_ThreeJS_Satellite_js_six_editor_3d
- A3_15_ThreeJS_Satellite_tsx_react_next_tle
- A3_16_ThreeJS_Satellite_js_tle_obj
- A3_17_ThreeJS_Satellite_js_tle_N2YO
- A3_18_ThreeJS_Satellite_js
- A3_19_ThreeJS_Satellite_js_2d3d
- A3_20_ThreeJS_Satellite_ts_react
- A3_21_ThreeJS_Satellite_ts_react
- A3_22_ThreeJS_Satellite_ts_react
- A3_23_ThreeJS_Satellite_js_react
- A3_24_ThreeJS_Satellite_js_python
- A3_25_ThreeJS_Satellite_js_react_python
- A3_26_ThreeJS_Satellite_js_react_next
- A3_27_ThreeJS_Satellite_js_react_next
- A3_28_ThreeJS_Satellite_js_react_vite_tle
- A3_29_ThreeJS_Satellite_js_react_leaflet_stellarium
- A3_30_ThreeJS_Satellite_js_tle_python
- A3_31_ThreeJS_Satellite_js_tle
- 3、测试代码(WebGL)
- 结语
1、简介
1.1 Three.JS
https://threejs.org/
Three.js 是一个基于 WebGL 的 JavaScript 3D 图形库,能够简化浏览器中复杂 3D 场景和动画的开发。它通过封装 WebGL 的底层复杂性,提供了直观的 API,支持几何体创建、材质与贴图、光照与阴影、动画控制等功能,适用于游戏开发、产品展示、教育培训、虚拟现实等多个领域。
npm install three
<!DOCTYPE html>
<html>
<head>
<title>Three.js 立方体旋转示例</title>
<style> body { margin: 0; } </style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
// 初始化场景、相机、渲染器
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// 创建立方体
const geometry = new THREE.BoxGeometry(2, 2, 2);
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// 调整相机位置
camera.position.z = 5;
// 动画循环
function animate() {
requestAnimationFrame(animate);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
// 窗口大小自适应
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
</script>
</body>
</html>
1.2 Satellite.JS
Satellite.js 是一个专注于卫星轨道计算的 JavaScript 工具库,基于 SGP4/SDP4 模型实现卫星位置与速度的预测。它通过解析 TLE(两行轨道根数)数据,支持低地球轨道(LEO)和中地球轨道(MEO)卫星的实时跟踪与轨迹模拟,常用于航天工程、天文观测及地理可视化应用。
npm install satellite.js
<!DOCTYPE html>
<html>
<head>
<title>Satellite.js 卫星位置示例</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/satellite.js@4.0.0/dist/satellite.min.js"></script>
<script>
// 定义卫星 TLE 数据(示例)
const tleLine1 = '1 25544U 98067A 21294.56194444 .00000606 00000-0 18532-4 0 9996';
const tleLine2 = '2 25544 51.6423 208.9163 0004018 152.5268 247.6898 15.48963555302849';
// 解析 TLE 数据
const satrec = satellite.twoline2satrec(tleLine1, tleLine2);
const date = new Date(); // 当前时间
// 计算卫星位置
const positionAndVelocity = satellite.propagate(satrec, date);
const gmst = satellite.gstime(date);
const positionGeodetic = satellite.eciToGeodetic(positionAndVelocity.position, gmst);
// 转换为经纬度(角度)
const longitude = satellite.degreesLong(positionGeodetic.longitude);
const latitude = satellite.degreesLat(positionGeodetic.latitude);
const altitude = positionGeodetic.height;
// 输出结果
console.log('卫星当前位置:', {
longitude: longitude.toFixed(4) + '°',
latitude: latitude.toFixed(4) + '°',
altitude: altitude.toFixed(2) + ' km'
});
</script>
</body>
</html>
2、测试代码(Three.JS)
A3_1_ThreeJS_Satellite_js


A3_2_ThreeJS_Satellite_js


A3_3_ThreeJS_Satellite_js_tle




A3_4_ThreeJS_Satellite_js_tle



A3_5_ThreeJS_Satellite_js_tle_python


A3_6_ThreeJS_Satellite_js_tle



A3_7_ThreeJS_Satellite_js_tle


A3_8_ThreeJS_Satellite_js_tle


A3_9_ThreeJS_Satellite_js_react_tle


A3_10_ThreeJS_Satellite_js_tle


A3_11_ThreeJS_Satellite_jsx_react_vite_tle


A3_12_ThreeJS_Satellite_js_tle_editor_3d


A3_13_ThreeJS_Satellite_js_six_editor_2d


A3_14_ThreeJS_Satellite_js_six_editor_3d


A3_15_ThreeJS_Satellite_tsx_react_next_tle


A3_16_ThreeJS_Satellite_js_tle_obj


A3_17_ThreeJS_Satellite_js_tle_N2YO

A3_18_ThreeJS_Satellite_js

A3_19_ThreeJS_Satellite_js_2d3d

A3_20_ThreeJS_Satellite_ts_react

A3_21_ThreeJS_Satellite_ts_react

A3_22_ThreeJS_Satellite_ts_react

A3_23_ThreeJS_Satellite_js_react

A3_24_ThreeJS_Satellite_js_python

A3_25_ThreeJS_Satellite_js_react_python

A3_26_ThreeJS_Satellite_js_react_next

A3_27_ThreeJS_Satellite_js_react_next

A3_28_ThreeJS_Satellite_js_react_vite_tle

A3_29_ThreeJS_Satellite_js_react_leaflet_stellarium

A3_30_ThreeJS_Satellite_js_tle_python

A3_31_ThreeJS_Satellite_js_tle

3、测试代码(WebGL)
C13_1_GIS_3dEarth_WebGL_satelliteJS_WorldWind


C13_2_GIS_3dEarth_WebGL_satelliteJS


结语
如果您觉得这些文字有一点点用处,请给作者点个赞;╮( ̄▽ ̄)╭
如果您有技术问题探讨,评论处留言。//(ㄒoㄒ)//
谢谢各位童鞋们啦( ´ ▽ ` )ノ ( ´ ▽ `` )っ!
更多精彩文章详见微信公众号:爱阅读的小沐
如需技术探讨 / 软件定制 / 代码分享,请加文章末尾的微信公众号或QQ!
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)