# 旋风

Communication comes from our hears and heads! my msn:youpeizun@hotmail.com

posts - 88, comments - 388, trackbacks - 27, articles - 1

### 公告

1． 距离/纬度关系

GPS: 22.514519,113.380301

GPS: 22.511962,113.380301

jl_wd=284.6439379583341/(22.51451-22.511962)

= 111712.69150641055729984301412873 (/)

2． 距离/经度关系

GPS: 22.514866, 113.388444

GPS: 22.514866, 113.379378

jl_jd =932.2997762326453/(113.388444-113.379378)

=102834.74258026089786013677476285(/)

3．勾股定理

wd_c=|(N1,-N2)|

A点与B点的经度差值的绝对值

jd_c=|(E2-E1)|

b=wd_c*jl_wd

a=jd_c*jl_jd

c=(a2 +b2)

C#实现代码:

/// <summary>

///计算两点GPS坐标的距离

/// </summary>

/// <param name="n1">第一点的纬度坐标</param>

/// <param name="e1">第一点的经度坐标</param>

/// <param name="n2">第二点的纬度坐标</param>

/// <param name="e2">第二点的经度坐标</param>

/// <returns></returns>
public static double Distance(double n1, double e1, double n2, double e2)
{

double jl_jd = 102834.74258026089786013677476285;

double jl_wd = 111712.69150641055729984301412873;

double b = Math.Abs((e1 - e2) * jl_jd);

double a = Math.Abs((n1 - n2) * jl_wd);

return Math.Sqrt((a * a + b * b));

}