Exemple #1
0
 /// <summary>
 /// 给定参数的七参数坐标转换
 /// </summary>
 /// <param name="info">转换参数</param>
 /// <returns>转换后的空间直角坐标</returns>
 public SpatialRectCoordinate CoordinateConvert(TransformParameters p)
 {
     if (dimension > 2)
     {
         return(Geodetic.CoordinateTransform(spatialCoord, p));
     }
     else
     {
         throw new Exception("进行坐标转换需要三维坐标");
     }
 }
Exemple #2
0
        /// <summary>
        /// 坐标转换
        /// </summary>
        /// <param name="xyzOld">旧坐标</param>
        /// <param name="xyzNew">新坐标</param>
        /// <param name="param">转换参数</param>
        public static void CoordinateTransform(double[] xyzOld, double[] xyzNew, TransformParameters param)
        {
            if (xyzNew.Length != 3 || xyzOld.Length != 3)
            {
                throw new Exception("坐标维数错误,必须为3");
            }
            SpatialRectCoordinate p1 = new SpatialRectCoordinate(xyzOld[0], xyzOld[1], xyzOld[2]);
            SpatialRectCoordinate p2 = CoordinateTransform(p1, param);

            xyzNew[0] = p2.X;
            xyzNew[1] = p2.Y;
            xyzNew[2] = p2.Z;
        }
Exemple #3
0
        /// <summary>
        /// 布尔莎七参数模型坐标转换,从大地坐标到大地坐标
        /// </summary>
        /// <param name="pntBLH"></param>
        /// <param name="eOld"></param>
        /// <param name="eNew"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static GeodeticCoordinate CoordinateTransform(GeodeticCoordinate pntBLH, ReferenceEllipsoid eOld, ReferenceEllipsoid eNew, TransformParameters param)
        {
            double X, Y, Z;

            BLH_XYZ(pntBLH.B, pntBLH.L, pntBLH.H, out X, out Y, out Z, eOld.a, eOld.f);

            SpatialRectCoordinate s = CoordinateTransform(new SpatialRectCoordinate(X, Y, Z), param);

            double B, L, H;

            XYZ_BLH(s.X, s.Y, s.Z, out B, out L, out H, eNew.a, eNew.f);
            return(new GeodeticCoordinate(B, L, H));
        }
Exemple #4
0
        /// <summary>
        /// 布尔莎七参数模型坐标转换,从空间直角坐标到空间直角坐标
        /// </summary>
        /// <param name="old"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        ///坐标转换时都是转XYZ,然后再将XYZ转换成BLH和xy
        /// WGS-84 --> BJZ54
        ///-15.415, 157.025, 94.74,   0.312, 0.08,  0.102, -1.465e-6        /*全国*/
        ///-14.756, 145.798, 100.886, 0.618, 0.255, 0.302, -0.439e-6        /*东南局部*/
        ///  BJZ54 --> DXZ88
        ///16.5,    -152.9,  -91.8,   -0.226, -0.003, 0.0, 1.22e-6
        public static SpatialRectCoordinate CoordinateTransform(Geo.Coordinates.IXYZ old, TransformParameters p)
        {
            double X, Y, Z;
            double rou = 206264.80624709635515647335733078;// 3600 * 180 / Consts.PI;

            X = p.Dx + old.X * (1 + p.m) + (old.Y * p.Ez - old.Z * p.Ey) / rou;
            Y = p.Dy + old.Y * (1 + p.m) + (old.Z * p.Ex - old.X * p.Ez) / rou;
            Z = p.Dz + old.Z * (1 + p.m) + (old.X * p.Ey - old.Y * p.Ex) / rou;

            return(new SpatialRectCoordinate(X, Y, Z));
        }