我正在使用OrbitTools库来使用类似于http://karhukoti.com的Bing Maps Silverlight控件开发卫星跟踪系统。
我不熟悉这个领域,缺乏很多与卫星跟踪相关的信息,但已开始自学,因为我的主管选择了这个特殊的项目作为毕业项目。
然而,我遇到了很多困难,主要的一个问题是如何将两线元素(TLE)信息转换为经度纬度和海拔高度,以便在地图上显示卫星和卫星路径。
我尝试了以下C#代码:
protected void DisplaySatellitePath(List<Eci> Pos)
{
MapLayer myRouteLayer = new MapLayer();
myMap.Children.Add(myRouteLayer);
foreach (Eci e in Pos)
{
CoordGeo coordinates = e.toGeo();
Ellipse point = new Ellipse();
point.Width = 10;
point.Height = 10;
point.Fill = new SolidColorBrush(Colors.Orange);
point.Opacity = 0.65;
//Location location = new Location(e.Position.X, e.Position.X);
Location location = new Location(coordinates.Latitude, coordinates.Longitude);
MapLayer.SetPosition(point, location);
MapLayer.SetPositionOrigin(point, PositionOrigin.Center);
myRouteLayer.Children.Add(point);
}
}
并尝试了
protected void DisplaySatellitePathSecondGo(List<Eci> Pos)
{
MapLayer myRouteLayer = new MapLayer();
myMap.Children.Add(myRouteLayer);
foreach (Eci e in Pos)
{
Ellipse point = new Ellipse();
point.Width = 10;
point.Height = 10;
point.Fill = new SolidColorBrush(Colors.Yellow);
point.Opacity = 0.65;
Site siteEquator = new Site(e.Position.X, e.Position.Y, e.Position.Z);
Location location = new Location(siteEquator.Latitude, siteEquator.Longitude);
MapLayer.SetPosition(point, location);
MapLayer.SetPositionOrigin(point, PositionOrigin.Center);
myRouteLayer.Children.Add(point);
}
}
你能告诉我这里我做错了什么吗?我在网上搜索了关于OrbitTools的例子或文件,但没有运气。
我真的希望有人使用这个库可以帮助我或建议一个更好的.NET库。
非常感谢。
答案 0 :(得分:2)
这仍然是你正在努力的事吗?我注意到当我下载代码时,他们有一个他们提供的演示程序以及库。在其中,他们展示了以下方法,我相信你一定要看一下:
static void PrintPosVel(Tle tle) { 轨道轨道=新轨道(tle); ArrayList Pos = new ArrayList();
// Calculate position, velocity
// mpe = "minutes past epoch"
for (int mpe = 0; mpe <= (360 * 4); mpe += 360)
{
// Get the position of the satellite at time "mpe".
// The coordinates are placed into the variable "eci".
Eci eci = orbit.getPosition(mpe);
// Push the coordinates object onto the end of the array
Pos.Add(eci);
}
// Print TLE data
Console.Write("{0}\n", tle.Name);
Console.Write("{0}\n", tle.Line1);
Console.Write("{0}\n", tle.Line2);
// Header
Console.Write("\n TSINCE X Y Z\n\n");
// Iterate over each of the ECI position objects pushed onto the
// position vector, above, printing the ECI position information
// as we go.
for (int i = 0; i < Pos.Count; i++)
{
Eci e = Pos[i] as Eci;
Console.Write("{0,4}.00 {1,16:f8} {2,16:f8} {3,16:f8}\n",
i * 360,
e.Position.X,
e.Position.Y,
e.Position.Z);
}
Console.Write("\n XDOT YDOT ZDOT\n\n");
// Iterate over each of the ECI position objects in the position
// vector again, but this time print the velocity information.
for (int i = 0; i < Pos.Count; i++)
{
Eci e = Pos[i] as Eci;
Console.Write("{0,24:f8} {1,16:f8} {2,16:f8}\n",
e.Velocity.X,
e.Velocity.Y,
e.Velocity.Z);
}
}
在这看来他们正在进行你正在寻找的转换。我错过了你实际遇到的问题吗?