コード例 #1
0
        /// <summary>
        /// 获取两点距离(GCJ-02)
        /// </summary>
        /// <param name="lat1">纬度1</param>
        /// <param name="log1">经度1</param>
        /// <param name="lat2">纬度2</param>
        /// <param name="log2">经度2</param>
        /// <returns></returns>
        public static double GetDistance_By_Gcj02(double lat1, double log1, double lat2, double log2)
        {
            var p1   = CoordinateUtil.Gcj02_To_Gps84(lat1, log1);
            var p2   = CoordinateUtil.Gcj02_To_Gps84(lat2, log2);
            var coor = Coordinates.CoordinateFactory.CreateCoordinate(Coordinates.Spheroid.WGS84);

            return(coor.DistanceOfTwoPoints(p1.getWgLon(), p1.getWgLat(), p2.getWgLon(), p2.getWgLat()));
        }
コード例 #2
0
        /// <summary>
        /// 百度坐标系(BD-09)-->84
        /// </summary>
        /// <param name="bd_lat">纬度</param>
        /// <param name="bd_lon">经度</param>
        /// <returns></returns>
        public static Position Bd09_To_Gps84(double bd_lat, double bd_lon)
        {
            Position gcj02 = CoordinateUtil.Bd09_To_Gcj02(bd_lat, bd_lon);
            Position map84 = CoordinateUtil.Gcj02_To_Gps84(gcj02.getWgLat(),
                                                           gcj02.getWgLon());

            return(map84);
        }