1

我有一个当前位置:以度为单位的纬度和经度值(A 点),最终位置(B 点)也是如此。我需要计算两点之间的路线(也以度为单位),然后以给定的速度(以公里/秒为单位)和时间跨度(以秒为单位)计算新位置。

示例(伪代码):

PointA.Lat = x.xxxx;
PointA.Lng = x.xxxx;
PointB.Lat = x.xxxx;
PointB.Lng = x.xxxx;
Speed = 3;
TimeSpan = 0.1;
Course = GetCourse(PointA, PointB);

NewPoint = CalculatePoint(PointA, Course, Speed, TimeSpan);

我想过使用 GeoCoordinate 类,但我不确定我必须如何实现自己的所有计算。(我没有 GPS - 这只是一个模拟,那些是假点)。

有人可以帮助我计算数学或提供一些可以免费完成并且可以轻松集成到我的代码中的软件包吗?

顺便说一句,我正在使用 C#。

谢谢。

4

1 回答 1

0

I'd have made this a comment but I don't have the required rep.

What you're looking for is a geodesy library that gives you the “geodetic inverse” and “geodetic direct” calculations. I don't know of any myself, but try searching for “c# geodesy library”</p>

The former gives the bearing and distance between two geographical coordinates, the latter gives a new coordinate at a given bearing and distance from the first.

So for your problem:

  1. Use the inverse to get the bearing between PointA and PointB
  2. Calculate a destination distance from the time and speed,
  3. Plug the bearing and distance into the direct to get the desired destination NewCoord.

Coding these calculations from 1st principles will be quite substantial and require the parameters of (presumably) the WGS84 ellipsoid. This, however, is the starting point.

Hope this helps.

于 2012-04-29T13:32:34.163 回答