GPS经纬度换算成X,Y坐标
/// <summary>
/// GPS经纬度换算成x,y坐标
/// </summary>
/// <param name="l">精度</param>
/// <param name="B">纬度</param>
/// <param name="xc">X坐标</param>
/// <param name="yc">Y坐标</param>
public static void MCT84Bl2xy(double l, double B, out double xc, out double yc)
{
try
{
l = l * Math.PI / 180;
B = B * Math.PI / 180;
double B0 = 30 * Math.PI / 180;
double N = 0, e = 0, a = 0, b = 0, e2 = 0, K = 0;
a = 6378137;
b = 6356752.3142;
e = Math.Sqrt(1 - (b / a) * (b / a));
e2 = Math.Sqrt((a / b) * (a / b) - 1);
double CosB0 = Math.Cos(B0);
N = (a * a / b) / Math.Sqrt(1 + e2 * e2 * CosB0 * CosB0);
K = N * CosB0;
double Pi = Math.PI;
double SinB = Math.Sin(B);
double tan = Math.Tan(Pi / 4 + B / 2);
double E2 = Math.Pow((1 - e * SinB) / (1 + e * SinB), e / 2);
double xx = tan * E2;
xc = K * Math.Log(xx);
yc = K * l;
return;
}
catch (Exception ErrInfo)
{
}
xc = -1;
yc = -1;
}
---------------------------------------------------------
专注移动开发
Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
posted on 2010-05-01 14:17
TiGERTiAN 阅读(8931)
评论(6) 编辑 收藏 所属分类:
DotNet