Пример #1
0
        /// <summary>
        /// Convert Lambert* point into WGS84 in radian
        /// </summary>
        /// <param name="org">Point to convert</param>
        /// <param name="zone">Lambert type</param>
        /// <returns>Converted point</returns>
        /// <remarks>WGS84 refers to greenwich</remarks>
        public static Point ConvertToWGS84(Point org, Enums.LambertZoneType zone)
        {
            var lzone = new LambertZone(zone);

            if (zone == Enums.LambertZoneType.Lambert93)
            {
                return(LambertToGeographic(org, lzone, LambertZone.LON_MERID_IERS, LambertZone.E_WGS84,
                                           LambertZone.DEFAULT_EPS));
            }

            var pt1 = LambertToGeographic(org, lzone, LambertZone.LON_MERID_PARIS, LambertZone.E_CLARK_IGN,
                                          LambertZone.DEFAULT_EPS);

            var pt2 = GeographicToCartesian(pt1.X, pt1.Y, pt1.Z, LambertZone.A_CLARK_IGN,
                                            LambertZone.E_CLARK_IGN);

            pt2.Translate(-168, -60, 320);

            //WGS84 refers to greenwich
            return(CartesianToGeographic(pt2, LambertZone.LON_MERID_GREENWICH, LambertZone.A_WGS84,
                                         LambertZone.E_WGS84, LambertZone.DEFAULT_EPS));
        }
Пример #2
0
        private static Point LambertToGeographic(Point org, LambertZone zone, double lonMeridian, double e, double eps)
        {
            var n  = zone.n();
            var c  = zone.c();
            var xs = zone.xs();
            var ys = zone.ys();

            var x = org.X;
            var y = org.Y;

            var r = Math.Sqrt((x - xs) * (x - xs) + (y - ys) * (y - ys));

            var gamma = Math.Atan((x - xs) / (ys - y));

            var lon = lonMeridian + gamma / n;

            var latIso = -1 / n * Math.Log(Math.Abs(r / c));

            var lat = LatitudeFromLatitudeIso(latIso, e, eps);

            var dest = new Point(lon, lat, 0);

            return(dest);
        }