Inheritance: MapProjection
示例#1
0
        /// <summary>
        /// Returns the inverse of this projection.
        /// </summary>
        /// <returns>IMathTransform that is the reverse of the current projection.</returns>
        public override IMathTransform Inverse()
        {
            if (_inverse == null)
            {
                _inverse = new KrovakProjection(this._Parameters, !_isInverse);
            }

            return(_inverse);
        }
示例#2
0
        /// <summary>
        /// Returns the inverse of this projection.
        /// </summary>
        /// <returns>IMathTransform that is the reverse of the current projection.</returns>
        public override IMathTransform Inverse()
        {
            if (_inverse == null)
            {
                _inverse = new KrovakProjection(_Parameters.ToProjectionParameter(), this);
            }

            return(_inverse);
        }
示例#3
0
        /// <summary>
        /// Creates an instance of an Albers projection object.
        /// </summary>
        /// <remarks>
        /// <para>The parameters this projection expects are listed below.</para>
        /// <list type="table">
        /// <listheader><term>Parameter</term><description>Description</description></listheader>
        /// <item><term>latitude_of_origin</term><description>The latitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
        /// <item><term>central_meridian</term><description>The longitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
        /// <item><term>standard_parallel_1</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is nearest the pole.  Scale is true along this parallel.</description></item>
        /// <item><term>standard_parallel_2</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is furthest from the pole.  Scale is true along this parallel.</description></item>
        /// <item><term>false_easting</term><description>The easting value assigned to the false origin.</description></item>
        /// <item><term>false_northing</term><description>The northing value assigned to the false origin.</description></item>
        /// </list>
        /// </remarks>
        /// <param name="parameters">List of parameters to initialize the projection.</param>
        /// <param name="inverse">Indicates whether the projection forward (meters to degrees or degrees to meters).</param>
        protected KrovakProjection(IEnumerable <ProjectionParameter> parameters, KrovakProjection inverse)
            : base(parameters, inverse)
        {
            Name = "Krovak";

            Authority     = "EPSG";
            AuthorityCode = 9819;

            //PROJCS["S-JTSK (Ferro) / Krovak",
            //GEOGCS["S-JTSK (Ferro)",
            //    DATUM["D_S_JTSK_Ferro",
            //        SPHEROID["Bessel 1841",6377397.155,299.1528128]],
            //    PRIMEM["Ferro",-17.66666666666667],
            //    UNIT["degree",0.0174532925199433]],
            //PROJECTION["Krovak"],
            //PARAMETER["latitude_of_center",49.5],
            //PARAMETER["longitude_of_center",42.5],
            //PARAMETER["azimuth",30.28813972222222],
            //PARAMETER["pseudo_standard_parallel_1",78.5],
            //PARAMETER["scale_factor",0.9999],
            //PARAMETER["false_easting",0],
            //PARAMETER["false_northing",0],
            //UNIT["metre",1]]

            //Check for missing parameters
            _azimuth = Degrees2Radians(_Parameters.GetParameterValue("azimuth"));
            _pseudoStandardParallel = Degrees2Radians(_Parameters.GetParameterValue("pseudo_standard_parallel_1"));

            central_meridian = Degrees2Radians(24 + (50.0 / 60));// par_longitude_of_center.Value);

            // Calculates useful constants.
            _sinAzim = Math.Sin(_azimuth);
            _cosAzim = Math.Cos(_azimuth);
            _n       = Math.Sin(_pseudoStandardParallel);
            _tanS2   = Math.Tan(_pseudoStandardParallel / 2 + S45);

            var sinLat = Math.Sin(lat_origin);
            var cosLat = Math.Cos(lat_origin);
            var cosL2  = cosLat * cosLat;

            _alfa = Math.Sqrt(1 + ((_es * (cosL2 * cosL2)) / (1 - _es))); // parameter B
            _hae  = _alfa * _e / 2;
            var u0 = Math.Asin(sinLat / _alfa);

            var esl = _e * sinLat;
            var g   = Math.Pow((1 - esl) / (1 + esl), (_alfa * _e) / 2);

            _k1 = Math.Pow(Math.Tan(lat_origin / 2 + S45), _alfa) * g / Math.Tan(u0 / 2 + S45);
            _ka = Math.Pow(1 / _k1, -1 / _alfa);

            double radius = Math.Sqrt(1 - _es) / (1 - (_es * (sinLat * sinLat)));

            _ro0 = scale_factor * radius / Math.Tan(_pseudoStandardParallel);
            _rop = _ro0 * Math.Pow(_tanS2, _n);
        }
        /// <summary>
        /// Returns the inverse of this projection.
        /// </summary>
        /// <returns>IMathTransform that is the reverse of the current projection.</returns>
        public override IMathTransform Inverse()
        {
            if (_inverse == null)
            {
                _inverse = new KrovakProjection(this._Parameters, !_isInverse);
            }

            return _inverse;
        }
示例#5
0
		/// <summary>
		/// Returns the inverse of this projection.
		/// </summary>
		/// <returns>IMathTransform that is the reverse of the current projection.</returns>
		public override IMathTransform Inverse()
		{
			if (_inverse == null)
			{
				_inverse = new KrovakProjection(_Parameters.ToProjectionParameter(), this);
			}

			return _inverse;
		}
示例#6
0
		/// <summary>
		/// Creates an instance of an Albers projection object.
		/// </summary>
		/// <remarks>
		/// <para>The parameters this projection expects are listed below.</para>
		/// <list type="table">
		/// <listheader><term>Parameter</term><description>Description</description></listheader>
		/// <item><term>latitude_of_origin</term><description>The latitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
		/// <item><term>central_meridian</term><description>The longitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item>
		/// <item><term>standard_parallel_1</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is nearest the pole.  Scale is true along this parallel.</description></item>
		/// <item><term>standard_parallel_2</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is furthest from the pole.  Scale is true along this parallel.</description></item>
		/// <item><term>false_easting</term><description>The easting value assigned to the false origin.</description></item>
		/// <item><term>false_northing</term><description>The northing value assigned to the false origin.</description></item>
		/// </list>
		/// </remarks>
		/// <param name="parameters">List of parameters to initialize the projection.</param>
		/// <param name="inverse">Indicates whether the projection forward (meters to degrees or degrees to meters).</param>
		protected KrovakProjection(IEnumerable<ProjectionParameter> parameters, KrovakProjection inverse)
			: base(parameters, inverse)
		{
			Name = "Krovak";

            Authority = "EPSG";
			AuthorityCode = 9819;

	        //PROJCS["S-JTSK (Ferro) / Krovak",
	        //GEOGCS["S-JTSK (Ferro)",
	        //    DATUM["D_S_JTSK_Ferro",
	        //        SPHEROID["Bessel 1841",6377397.155,299.1528128]],
	        //    PRIMEM["Ferro",-17.66666666666667],
	        //    UNIT["degree",0.0174532925199433]],
	        //PROJECTION["Krovak"],
	        //PARAMETER["latitude_of_center",49.5],
	        //PARAMETER["longitude_of_center",42.5],
	        //PARAMETER["azimuth",30.28813972222222],
	        //PARAMETER["pseudo_standard_parallel_1",78.5],
	        //PARAMETER["scale_factor",0.9999],
	        //PARAMETER["false_easting",0],
	        //PARAMETER["false_northing",0],
	        //UNIT["metre",1]]

			//Check for missing parameters
            _azimuth = Degrees2Radians(_Parameters.GetParameterValue("azimuth"));
			_pseudoStandardParallel = Degrees2Radians(_Parameters.GetParameterValue("pseudo_standard_parallel_1"));
            
            // Calculates useful constants.
			_sinAzim = Math.Sin(_azimuth);
			_cosAzim = Math.Cos(_azimuth);
			_n       = Math.Sin(_pseudoStandardParallel);
			_tanS2   = Math.Tan(_pseudoStandardParallel / 2 + S45);

            var sinLat = Math.Sin(lat_origin);
            var cosLat = Math.Cos(lat_origin);
            var cosL2 = cosLat * cosLat;
            _alfa = Math.Sqrt(1 + ((_es * (cosL2 * cosL2)) / (1 - _es))); // parameter B
			_hae    = _alfa * _e / 2;
            var u0 = Math.Asin(sinLat / _alfa);

            var esl = _e * sinLat;
            var g = Math.Pow((1 - esl) / (1 + esl), (_alfa * _e) / 2);
            _k1 = Math.Pow(Math.Tan(lat_origin / 2 + S45), _alfa) * g / Math.Tan(u0 / 2 + S45);
			_ka  = Math.Pow(1 / _k1, -1 / _alfa);

            double radius = Math.Sqrt(1 - _es) / (1 - (_es * (sinLat * sinLat)));

			_ro0 = scale_factor * radius / Math.Tan(_pseudoStandardParallel);
			_rop = _ro0 * Math.Pow(_tanS2, _n);
		}
        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 "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;
        }