Javascript 使用TLE线在地面轨迹图上显示轨道
我尝试在地面轨道地图上绘制轨道,使用JS:Javascript 使用TLE线在地面轨迹图上显示轨道,javascript,Javascript,我尝试在地面轨道地图上绘制轨道,使用JS: 1 45657U 20035A 20196.59974008 .38210219 12083-4 47903-3 0 9997 2 45657 53.0001 319.7129 0028054 181.2741 293.9291 16.46735707 7405 var属性= '地图数据和副本;贡献者; var tile=“https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png”; var
1 45657U 20035A 20196.59974008 .38210219 12083-4 47903-3 0 9997
2 45657 53.0001 319.7129 0028054 181.2741 293.9291 16.46735707 7405
var属性=
'地图数据和副本;贡献者;
var tile=“https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png”;
var tle_Pos=getPosVel();
var经度=tle_位置经度
var纬度=tle_位置纬度
var worldMap=drawMap();
var objectDrawer=drawObject();
函数getPosVel(){
变量tleLine1='145657U 20035A 20196.59974008.38210219 12083-4 47903-3 0 9997',
tleLine2='24565753.0001 319.7129 0028054 181.2741 293.9291 16.46735707 7405';
var gmst=satellite.gstime(新日期());
var satrec=卫星.twoline2satrec(tleLine1,tleLine2);
var positionAndVelocity=satellite.propagate(satrec,new Date());
var gmst=satellite.gstime(新日期());
var geodeticCoords=卫星坐标(位置和速度坐标,gmst);
控制台日志(大地测量坐标);
返回大地坐标
}
函数drawMap(){
var map=L.map(“mapid”).setView([0,0],4);
L.tileLayer(瓷砖{
最大缩放:25,
最小缩放:1.8,
归因:归因
}).addTo(地图);
返回图;
}
函数drawObject(){
返回L.marker([经度,纬度]).addTo(世界地图);
}
我曾尝试使用satellite.js和传单地图,但在这样做时遇到了两个问题,首先我无法预测和绘制轨道,而不仅仅是物体当前的纬度和经度,其次,当我提供下面的TLE线时,它根本不起作用,当我提供常规ISS TLE线时,它工作了,但我认为纬度和经度根本不准确
除了satellite.js之外,还有其他替代方法吗?或者有没有正确的方法来绘制TLE线的完整轨道
额外:这是我希望地图看起来如何的示例。我无法打开您的图像链接。还可以尝试在JSFIDLE或类似网站中创建一个工作示例
var attribution =
'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors';
var tile = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
var tle_Pos = getPosVel();
var longitude = tle_Pos.longitude
var latitude = tle_Pos.latitude
var worldMap = drawMap();
var objectDrawer = drawObject();
function getPosVel(){
var tleLine1 = '1 45657U 20035A 20196.59974008 .38210219 12083-4 47903-3 0 9997',
tleLine2 = '2 45657 53.0001 319.7129 0028054 181.2741 293.9291 16.46735707 7405';
var gmst = satellite.gstime(new Date());
var satrec = satellite.twoline2satrec(tleLine1, tleLine2);
var positionAndVelocity = satellite.propagate(satrec, new Date());
var gmst = satellite.gstime(new Date());
var geodeticCoords = satellite.eciToGeodetic(positionAndVelocity.position, gmst);
console.log(geodeticCoords);
return geodeticCoords
}
function drawMap() {
var map = L.map("mapid").setView([0, 0], 4);
L.tileLayer(tile, {
maxZoom: 25,
minZoom: 1.8,
attribution: attribution
}).addTo(map);
return map;
}
function drawObject() {
return L.marker([longitude, latitude]).addTo(worldMap);
}