/// <summary>
        /// 构建不同的投影变换方法
        /// </summary>
        /// <param name="projection"></param>
        /// <param name="ellipsoid"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        private static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid, ILinearUnit unit)
        {
            List <ProjectionParameter> parameterList = new List <ProjectionParameter>(projection.NumParameters);

            for (int i = 0; i < projection.NumParameters; i++)
            {
                parameterList.Add(projection.GetParameter(i));
            }

            parameterList.Add(new ProjectionParameter("semi_major", ellipsoid.SemiMajorAxis)); //长轴
            parameterList.Add(new ProjectionParameter("semi_minor", ellipsoid.SemiMinorAxis)); //短轴
            parameterList.Add(new ProjectionParameter("unit", unit.MetersPerUnit));            //单位弧度
            IMathTransform transform = null;

            switch (projection.ClassName.ToLower(CultureInfo.InvariantCulture).Replace(' ', '_'))
            {
            case "mercator":
            case "mercator_1sp":
            case "mercator_2sp":
                //1SP
                transform = new Mercator(parameterList);
                break;

            case "transverse_mercator":
                transform = new TransverseMercator(parameterList);
                break;

            case "gauss_kruger":    //高斯克吕格投影
                transform = new GaussKrugerProjection(parameterList);
                break;

            case "albers":
            case "albers_conic_equal_area":
                transform = new AlbersProjection(parameterList);
                break;

            case "krovak":
                transform = new KrovakProjection(parameterList);
                break;

            case "lambert_conformal_conic":
            case "lambert_conformal_conic_2sp":
            case "lambert_conic_conformal_(2sp)":
                transform = new LambertConformalConic2SP(parameterList);
                break;

            default:
                throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName));
            }
            return(transform);
        }
        public void SetUp()
        {
            Dictionary <CoordinateOperationParameter, Object> parameters = new Dictionary <CoordinateOperationParameter, Object>();

            parameters.Add(CoordinateOperationParameters.LatitudeOfProjectionCentre, Angle.FromDegree(49, 30, 0));
            parameters.Add(CoordinateOperationParameters.LongitudeOfOrigin, Angle.FromDegree(24, 50, 0));
            parameters.Add(CoordinateOperationParameters.CoLatitudeOfConeAxis, Angle.FromDegree(30, 17, 17.303));
            parameters.Add(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel, Angle.FromDegree(78, 30, 0));
            parameters.Add(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel, 0.9999);
            parameters.Add(CoordinateOperationParameters.FalseEasting, Length.FromMetre(0));
            parameters.Add(CoordinateOperationParameters.FalseNorthing, Length.FromMetre(0));

            Ellipsoid ellipsoid = Ellipsoid.FromInverseFlattening("EPSG::7004", "Bessel 1841", 6377397.155, 299.1528128);
            AreaOfUse areaOfUse = TestUtilities.ReferenceProvider.AreasOfUse["EPSG::1306"];

            this.projection = new KrovakProjection("EPSG::2065", "S-JTSK (Ferro) / Krovak", parameters, ellipsoid, areaOfUse);
        }
Example #3
0
        public void SetUp()
        {
            Dictionary <CoordinateOperationParameter, Object> parameters = new Dictionary <CoordinateOperationParameter, Object>();

            parameters.Add(CoordinateOperationParameters.LatitudeOfProjectionCentre, Angle.FromDegree(49, 30, 0));
            parameters.Add(CoordinateOperationParameters.LongitudeOfOrigin, Angle.FromDegree(24, 50, 0));
            parameters.Add(CoordinateOperationParameters.CoLatitudeOfConeAxis, Angle.FromDegree(30, 17, 17.303));
            parameters.Add(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel, Angle.FromDegree(78, 30, 0));
            parameters.Add(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel, 0.9999);
            parameters.Add(CoordinateOperationParameters.FalseEasting, Length.FromMetre(0));
            parameters.Add(CoordinateOperationParameters.FalseNorthing, Length.FromMetre(0));

            _krovakProjection = new KrovakProjection("EPSG::2065", "S-JTSK (Ferro) / Krovak", parameters, Ellipsoids.Bessel1841, AreasOfUse.World);

            parameters = new Dictionary <CoordinateOperationParameter, Object>();
            parameters.Add(CoordinateOperationParameters.LatitudeOfProjectionCentre, Angle.FromDegree(49, 30, 0));
            parameters.Add(CoordinateOperationParameters.LongitudeOfOrigin, Angle.FromDegree(24, 50, 0));
            parameters.Add(CoordinateOperationParameters.CoLatitudeOfConeAxis, Angle.FromDegree(30, 17, 17.303));
            parameters.Add(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel, Angle.FromDegree(78, 30, 0));
            parameters.Add(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel, 0.9999);
            parameters.Add(CoordinateOperationParameters.FalseEasting, Length.FromMetre(0));
            parameters.Add(CoordinateOperationParameters.FalseNorthing, Length.FromMetre(0));

            _krovakNorthOrientedProjection = new KrovakNorthOrientedProjection("ESPG::5225", "S-JTSK/05 (Ferro) / Modified Krovak East North", parameters, Ellipsoids.Bessel1841, AreasOfUse.World);

            parameters = new Dictionary <CoordinateOperationParameter, Object>();
            parameters.Add(CoordinateOperationParameters.LatitudeOfProjectionCentre, Angle.FromDegree(49, 30, 0));
            parameters.Add(CoordinateOperationParameters.LongitudeOfOrigin, Angle.FromDegree(24, 50, 0));
            parameters.Add(CoordinateOperationParameters.CoLatitudeOfConeAxis, Angle.FromDegree(30, 17, 17.3031));
            parameters.Add(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel, Angle.FromDegree(78, 30, 0));
            parameters.Add(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel, 0.9999);
            parameters.Add(CoordinateOperationParameters.FalseEasting, Length.FromMetre(5000000));
            parameters.Add(CoordinateOperationParameters.FalseNorthing, Length.FromMetre(5000000));
            parameters.Add(CoordinateOperationParameters.Ordinate1OfEvaluationPoint, Length.FromMetre(1089000));
            parameters.Add(CoordinateOperationParameters.Ordinate2OfEvaluationPoint, Length.FromMetre(654000));
            parameters.Add(CoordinateOperationParameters.C1, 2.946529277 * Math.Pow(10, -2));
            parameters.Add(CoordinateOperationParameters.C2, 2.515965696 * Math.Pow(10, -2));
            parameters.Add(CoordinateOperationParameters.C3, 1.193845912 * Math.Pow(10, -7));
            parameters.Add(CoordinateOperationParameters.C4, -4.668270147 * Math.Pow(10, -7));
            parameters.Add(CoordinateOperationParameters.C5, 9.233980362 * Math.Pow(10, -12));
            parameters.Add(CoordinateOperationParameters.C6, 1.523735715 * Math.Pow(10, -12));
            parameters.Add(CoordinateOperationParameters.C7, 1.696780024 * Math.Pow(10, -18));
            parameters.Add(CoordinateOperationParameters.C8, 4.408314235 * Math.Pow(10, -18));
            parameters.Add(CoordinateOperationParameters.C9, -8.331083518 * Math.Pow(10, -24));
            parameters.Add(CoordinateOperationParameters.C10, -3.689471323 * Math.Pow(10, -24));

            _krovakModifiedProjection = new KrovakModifiedProjection("ESPG::1042", "Czech Republic and Slovakia", parameters, Ellipsoids.Bessel1841, AreasOfUse.World);

            parameters = new Dictionary <CoordinateOperationParameter, Object>();
            parameters.Add(CoordinateOperationParameters.LatitudeOfProjectionCentre, Angle.FromDegree(49, 30, 0));
            parameters.Add(CoordinateOperationParameters.LongitudeOfOrigin, Angle.FromDegree(24, 50, 0));
            parameters.Add(CoordinateOperationParameters.CoLatitudeOfConeAxis, Angle.FromDegree(30, 17, 17.3031));
            parameters.Add(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel, Angle.FromDegree(78, 30, 0));
            parameters.Add(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel, 0.9999);
            parameters.Add(CoordinateOperationParameters.FalseEasting, Length.FromMetre(5000000));
            parameters.Add(CoordinateOperationParameters.FalseNorthing, Length.FromMetre(5000000));
            parameters.Add(CoordinateOperationParameters.Ordinate1OfEvaluationPoint, Length.FromMetre(1089000));
            parameters.Add(CoordinateOperationParameters.Ordinate2OfEvaluationPoint, Length.FromMetre(654000));
            parameters.Add(CoordinateOperationParameters.C1, 2.946529277 * Math.Pow(10, -2));
            parameters.Add(CoordinateOperationParameters.C2, 2.515965696 * Math.Pow(10, -2));
            parameters.Add(CoordinateOperationParameters.C3, 1.193845912 * Math.Pow(10, -7));
            parameters.Add(CoordinateOperationParameters.C4, -4.668270147 * Math.Pow(10, -7));
            parameters.Add(CoordinateOperationParameters.C5, 9.233980362 * Math.Pow(10, -12));
            parameters.Add(CoordinateOperationParameters.C6, 1.523735715 * Math.Pow(10, -12));
            parameters.Add(CoordinateOperationParameters.C7, 1.696780024 * Math.Pow(10, -18));
            parameters.Add(CoordinateOperationParameters.C8, 4.408314235 * Math.Pow(10, -18));
            parameters.Add(CoordinateOperationParameters.C9, -8.331083518 * Math.Pow(10, -24));
            parameters.Add(CoordinateOperationParameters.C10, -3.689471323 * Math.Pow(10, -24));

            _krovakModifiedNorthOrientedProjection = new KrovakModifiedNorthOrientedProjection("ESPG::1043", "Czech Republic and Slovakia", parameters, Ellipsoids.Bessel1841, AreasOfUse.World);
        }