zoukankan      html  css  js  c++  java
  • ArcGIS上根据经纬度求地球表面两点间距离的实现

    ArcGIS上根据经纬度求地球表面两点间距离的实现

    以米为单位。.Net2.0,C#实现。
           public static double DistanceOfTwoPoints(double lng1,double lat1, double lng2, double lat2, GaussSphere gs)
            {           
                double radLat1 = Rad(lat1);
                double radLat2 = Rad(lat2);
                double a = radLat1 - radLat2;
                double b = Rad(lng1) - Rad(lng2);
                double s = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) +
                 Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / 2), 2)));

    字串3
                s = s * (gs == GaussSphere.WGS84 ? 6378137.0 : (gs == GaussSphere.Xian80 ? 6378140.0 : 6378245.0));
                s = Math.Round(s * 10000) / 10000;
                return s;
            }
           
            private static double Rad(double d)
            {
                return d * Math.PI / 180.0;
            } 字串9

        GaussSphere 为自定义枚举类型
        /// <summary>
        /// 高斯投影中所选用的参考椭球
        /// </summary>
        public enum GaussSphere
        {
            Beijing54,
            Xian80,
            WGS84,
        }

    from: http://hi.baidu.com/bell9527/item/732ac2fe7db97eec1b111f9d

  • 相关阅读:
    1.1 HTML5简介
    MATLAB基础知识——1.1MATLAB系统变量
    初识MATLAB
    Z-Stack
    [C语言]关于struct和typedef struct
    [Zigbee]定时器1
    常用数论算法
    SPFA&邻接表 PASCAL
    kruskal算法-Pascal
    懒惰的JY--关于遍历
  • 原文地址:https://www.cnblogs.com/yuxuetaoxp/p/3284259.html
Copyright © 2011-2022 走看看