小编ahm*_*ad 的帖子

如何计算2个坐标之间的距离

我需要使用c#找到Windows 8.1应用程序中2点之间的距离(Km),所以我使用了下面的函数,但是返回的值不正确请求:

public static double DistanceTo(Double latitude1, Double longitude1, Double latitude2, Double longitude2)
    {
        var a = latitude1 - latitude2;
        var b = longitude1 - longitude2;

        return Math.Sqrt(a * a + b * b);
    }
Run Code Online (Sandbox Code Playgroud)

c#

2
推荐指数
1
解决办法
5510
查看次数

标签 统计

c# ×1