小编Sri*_*Sri的帖子

计算端点给定距离,方位,起点

我试图找到目的地点,给定起点纬度/长度,方位和距离.下面这个网站的计算器给了我想要的结果.

http://www.movable-type.co.uk/scripts/latlong.html

当我尝试通过代码实现相同的时候,我得不到正确的结果.

以下是我的代码 -

    private  GLatLng pointRadialDistance(double lat1, double lon1,
               double radianBearing, double radialDistance)
    {
        double rEarth = 6371.01;
        lat1 = DegreeToRadian(lat1);
        lon1 = DegreeToRadian(lon1);
        radianBearing = DegreeToRadian(radianBearing);
        radialDistance = radialDistance / rEarth;
        double lat = Math.Asin(Math.Sin(lat1) * Math.Cos(radialDistance) + Math.Cos(lat1)
                        * Math.Sin(radialDistance) * Math.Cos(radianBearing));
        double lon;
        if (Math.Cos(lat) == 0)
        {  // Endpoint a pole 
            lon = lon1;
        }
        else
        {
            lon = ((lon1 - Math.Asin(Math.Sin(radianBearing) * Math.Sin(radialDistance) / Math.Cos(lat))
                            + Math.PI) % (2 * Math.PI)) - Math.PI; …
Run Code Online (Sandbox Code Playgroud)

.net c# gis geospatial computational-geometry

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

computational-geometry ×1

geospatial ×1

gis ×1