zoukankan      html  css  js  c++  java
  • GPS经纬度换算成XY坐标

             ///<summary>
           
    /// GPS经纬度换算成x,y坐标
           
    ///</summary>
           
    ///<param name="l">精度</param>
           
    ///<param name="B">纬度</param>
           
    ///<param name="xc">X坐标</param>
           
    ///<param name="yc">Y坐标</param>
            publicstaticvoid MCT84Bl2xy(double l, double B, outdouble xc, outdouble 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;
            }

  • 相关阅读:
    C# 为WebBrowser设置代理,打开网页
    C# WebBrowser 设置代理完全解决方案
    java读取文件的几种方式性能比较
    .NET 对文件和文件夹操作的介绍
    java利用反射打印出类的结构
    java输出月的日历控制台
    java 实现二分查找算法
    java实现快速排序
    解决window 12 service 不能调用excel ,报"System.Runtime.InteropServices.COMException (0x800A03EC)
    3 webpack 4 加vue 2.0生产环境搭建
  • 原文地址:https://www.cnblogs.com/yang_mysky/p/3272492.html
Copyright © 2011-2022 走看看