示例#1
0
        /// <summary>
        /// 地球坐标(WGS-84)转火星坐标 (GCJ-02)
        /// </summary>
        /// <param name="wgsPoint">地球坐标(WGS-84)</param>
        /// <returns>火星坐标 (GCJ-02)</returns>
        public static LatLngPoint WGS84ToGCJ02(LatLngPoint wgsPoint)
        {
            if (GeoHelper.OutOfChina(wgsPoint))
            {
                return(wgsPoint);
            }

            LatLngPoint _transPoint = Transform(wgsPoint);

            return(new LatLngPoint(wgsPoint.LatY + _transPoint.LatY, wgsPoint.LonX + _transPoint.LonX));
        }
示例#2
0
        /// <summary>
        /// 火星坐标转 (GCJ-02)地球坐标(WGS-84)
        /// </summary>
        /// <param name="gcjPoint">火星坐标转 (GCJ-02)</param>
        /// <returns>地球坐标(WGS-84)</returns>
        public static LatLngPoint GCJ02ToWGS84(LatLngPoint gcjPoint)
        {
            if (GeoHelper.OutOfChina(gcjPoint))
            {
                return(gcjPoint);
            }

            LatLngPoint _transPoint = Transform(gcjPoint);

            return(new LatLngPoint(gcjPoint.LatY - _transPoint.LatY, gcjPoint.LonX - _transPoint.LonX));
        }
示例#3
0
        /// <summary>
        /// 地球坐标(WGS-84)转火星坐标 (GCJ-02)
        /// </summary>
        /// <param name="wgsPoint">地球坐标(WGS-84)</param>
        /// <returns>火星坐标 (GCJ-02)</returns>
        public LatLngPoint WGS84ToGCJ02(LatLngPoint wgsPoint)
        {
            MapCoord _findedCoord = QueryOffSetData(wgsPoint);
            double   _pixY        = GeoHelper.LatToPixel(wgsPoint.LatY, 18);
            double   _pixX        = GeoHelper.LonToPixel(wgsPoint.LonX, 18);

            _pixY += _findedCoord.Y_off;
            _pixX += _findedCoord.X_off;
            double _lat = GeoHelper.PixelToLat(_pixY, 18);
            double _lng = GeoHelper.PixelToLon(_pixX, 18);

            return(new LatLngPoint(_lat, _lng));
        }
示例#4
0
        /// <summary>
        /// 火星坐标转 (GCJ-02)地球坐标(WGS-84)
        /// </summary>
        /// <param name="gcjPoint">火星坐标转 (GCJ-02)</param>
        /// <returns>地球坐标(WGS-84)</returns>
        public LatLngPoint GCJ02ToWGS84(LatLngPoint gcjPoint)
        {
            MapCoord _findedCoord = QueryOffSetData(gcjPoint);
            double   _pixY        = GeoHelper.LatToPixel(gcjPoint.LatY, 18);
            double   _pixX        = GeoHelper.LonToPixel(gcjPoint.LonX, 18);

            _pixY -= _findedCoord.Y_off;
            _pixX -= _findedCoord.X_off;
            double _lat = GeoHelper.PixelToLat(_pixY, 18);
            double _lng = GeoHelper.PixelToLon(_pixX, 18);

            return(new LatLngPoint(_lat, _lng));
        }