Esempio n. 1
0
        /// <summary>
        /// Gets the item with the specified properties.
        /// </summary>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="areaOfUse">The area of use.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The instance with the specified identifier.</returns>
        public CoordinateProjection this[CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, AreaOfUse areaOfUse, Ellipsoid ellipsoid]
        {
            get
            {
                if (method == null)
                {
                    return(null);
                }
                if (areaOfUse == null)
                {
                    return(null);
                }
                if (ellipsoid == null)
                {
                    return(null);
                }

                CoordinateProjectionData matchingData = this.dataCollection.Where(data => data != null && this.projectionTypes.ContainsKey(data.Method.Code)).FirstOrDefault(data => data.Method.Equals(method) && (areaOfUse.Equals(AreaOfUse.Undefined) || data.AreaOfUse.Equals(areaOfUse)) && this.IsMatching(data.Parameters, parameters));

                // no matching projection is available
                if (matchingData == null)
                {
                    return(null);
                }

                return(this.CreateProjection(matchingData, ellipsoid));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Computes the coordinate projection.
        /// </summary>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The coordinate projection.</returns>
        /// <exception cref="System.IO.InvalidDataException">Projection code is invalid.</exception>
        private CoordinateProjection ComputeProjection(Ellipsoid ellipsoid)
        {
            Int32 code = Convert.ToInt32(_currentGeoKeys[GeoKey.Projection]);

            if (code >= 10000 && code <= 19999)
            {
                return(CoordinateProjectionFactory.FromIdentifier("EPSG::" + code, ellipsoid).FirstOrDefault());
            }

            if (code == Int16.MaxValue)
            {
                CoordinateOperationMethod method = ComputeCoordinateOperationMethod();
                Dictionary <CoordinateOperationParameter, Object> parameters = ComputeCoordinateOperationParameters();

                return(CoordinateProjectionFactory.FromMethod(method, parameters, ellipsoid, AreasOfUse.World));
            }

            throw new InvalidDataException("Projection code is invalid.");
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a collection with items matching the specified properties.
        /// </summary>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="areaOfUse">The area of use.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <returns>The instance with the specified properties.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The area of use is null.
        /// or
        /// The ellipsoid is null.
        /// </exception>
        public IEnumerable <CoordinateProjection> WithProperties(CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, AreaOfUse areaOfUse, Ellipsoid ellipsoid)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            if (areaOfUse == null)
            {
                throw new ArgumentNullException(nameof(areaOfUse));
            }
            if (ellipsoid == null)
            {
                throw new ArgumentNullException(nameof(ellipsoid));
            }

            this.EnsureOperationTypes();

            return(this.dataCollection.Where(data => data != null && this.projectionTypes.ContainsKey(data.Method.Code)).Where(data => data.Method.Equals(method) && (areaOfUse.Equals(AreaOfUse.Undefined) || data.AreaOfUse.Equals(areaOfUse)) && this.IsMatching(data.Parameters, parameters)).Select(data => this.CreateProjection(data, ellipsoid)));
        }
Esempio n. 4
0
            /// <summary>
            /// Converts the specified content.
            /// </summary>
            /// <param name="content">The content.</param>
            /// <returns>The converted reference.</returns>
            protected override CoordinateProjectionData Convert(String[] content)
            {
                this.EnsureProjectionParameters();

                CoordinateOperationMethod method = !String.IsNullOrEmpty(content[10]) ? this.methodCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[10])).FirstOrDefault() : null;
                AreaOfUse areaOfUse = this.areaOfUseCollection.WithIdentifier(IdentifiedObject.GetIdentifier(Authority, content[7])).FirstOrDefault();

                // TODO: remove condition, once all projections are implemented
                if (method == null)
                {
                    return(null);
                }

                return(new CoordinateProjectionData(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                    content[13], this.GetAliases(Int32.Parse(content[0])),
                                                    method,
                                                    this.projectionParameters.ContainsKey(Int32.Parse(content[0])) ? this.projectionParameters[Int32.Parse(content[0])] : null,
                                                    areaOfUse));
            }
            /// <summary>
            /// Converts the specified content.
            /// </summary>
            /// <param name="content">The content.</param>
            /// <returns>The converted reference.</returns>
            protected override CoordinateTransformationData Convert(String[] content)
            {
                this.EnsureTransformationParameters();

                CoordinateOperationMethod method = !String.IsNullOrEmpty(content[10]) ? this.methodCollection[Authority, Int32.Parse(content[10])] : null;
                CoordinateReferenceSystem source = this.referenceSystemCollection[Authority, Int32.Parse(content[3])];
                CoordinateReferenceSystem target = this.referenceSystemCollection[Authority, Int32.Parse(content[4])];

                AreaOfUse areaOfUse = this.areaOfUseCollection[Authority, Int32.Parse(content[7])];

                // TODO: remove condition, once all operations are implemented
                if (method == null)
                {
                    return(null);
                }

                return(new CoordinateTransformationData(IdentifiedObject.GetIdentifier(Authority, content[0]), content[1],
                                                        content[13], this.GetAliases(Int32.Parse(content[0])),
                                                        method,
                                                        this.transformationParameters.ContainsKey(Int32.Parse(content[0])) ? this.transformationParameters[Int32.Parse(content[0])] : null,
                                                        source,
                                                        target,
                                                        areaOfUse));
            }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MercatorProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected MercatorProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.longitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.falseEasting             = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing            = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            this.ellipsoidRadius = this.Ellipsoid.SemiMajorAxis.Value;
            this.inverseParams   = new Double[]
            {
                (this.Ellipsoid.EccentricitySquare / 2 + 5 * Math.Pow(this.Ellipsoid.Eccentricity, 4) / 24 + Math.Pow(this.Ellipsoid.Eccentricity, 6) / 12 + 13 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 360),
                (7 * Math.Pow(this.Ellipsoid.Eccentricity, 4) / 48 + 29 * Math.Pow(this.Ellipsoid.Eccentricity, 6) / 240 + 811 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 11520),
                (7 * Math.Pow(this.Ellipsoid.Eccentricity, 6) / 120 + 81 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 1120),
                4279 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 161280
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EquidistantCylindricalProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected EquidistantCylindricalProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOf1stStadardParallel = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOf1stStandardParallel);
            this.longitudeOfNaturalOrigin     = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.falseEasting  = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            this.nu1 = this.Ellipsoid.SemiMajorAxis.Value / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOf1stStadardParallel));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ObliqueMercatorProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The identifier is null.
        /// or
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected ObliqueMercatorProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOfProjectionCentre  = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfProjectionCentre);
            this.longitudeOfProjectionCentre = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfProjectionCentre);
            this.scaleFactorOnInitialLine    = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorOnInitialLine);
            this.azimuthOfInitialLine        = this.GetParameterBaseValue(CoordinateOperationParameters.AzimuthOfInitialLine);

            this.b = Math.Sqrt(1 + (this.Ellipsoid.EccentricitySquare * Calculator.Cos4(this.latitudeOfProjectionCentre) / (1 - this.Ellipsoid.EccentricitySquare)));
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HelmertTransformation" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="source">The source coordinate reference system.</param>
        /// <param name="target">The target coordinate reference system.</param>
        /// <param name="areaOfUse">The area of use.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The identifier is null.
        /// or
        /// The method is null.
        /// or
        /// The source coordinate reference system is null.
        /// or
        /// The target coordinate reference system is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected HelmertTransformation(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, GeographicCoordinateReferenceSystem source, GeographicCoordinateReferenceSystem target, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, source, target, areaOfUse)
        {
            this.xAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.XAxisTranslation);
            this.yAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.YAxisTranslation);
            this.zAxisTranslation = this.GetParameterValue(CoordinateOperationParameters.ZAxisTranslation);
            this.xAxisRotation    = this.GetParameterValue(CoordinateOperationParameters.XAxisRotation);
            this.yAxisRotation    = this.GetParameterValue(CoordinateOperationParameters.YAxisRotation);
            this.zAxisRotation    = this.GetParameterValue(CoordinateOperationParameters.ZAxisRotation);
            this.scaleDifference  = this.GetParameterValue(CoordinateOperationParameters.ScaleDifference);

            this.m = 1 + this.scaleDifference * 1E-6;
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HotineObliqueMercatorProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The identifier is null.
        /// or
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected HotineObliqueMercatorProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.angleFromRectifiedToSkewGrid = this.GetParameterBaseValue(CoordinateOperationParameters.AngleFromRectifiedToSkewGrid);

            this.a = this.Ellipsoid.SemiMajorAxis.Value * this.b * this.scaleFactorOnInitialLine * Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare) / (1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfProjectionCentre));
            Double tO = Math.Tan(Math.PI / 4 - this.latitudeOfProjectionCentre / 2) / Math.Pow((1 - this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)) / (1 + this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)), this.Ellipsoid.Eccentricity / 2);
            Double d  = this.b * Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare) / Math.Cos(this.latitudeOfProjectionCentre) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfProjectionCentre));
            Double f  = d + Math.Sqrt(Math.Max(d * d, 1) - 1) * Math.Sign(this.latitudeOfProjectionCentre) * Math.Sign(this.latitudeOfProjectionCentre);

            this.h = f * Math.Pow(tO, this.b);
            Double g = (f - 1 / f) / 2;

            this.gammaO  = Math.Asin(Math.Sin(this.azimuthOfInitialLine) / d);
            this.lambdaO = this.longitudeOfProjectionCentre - Math.Asin(g * Math.Tan(this.gammaO)) / this.b;

            if (this.azimuthOfInitialLine == Math.PI)
            {
                this.uC = this.Ellipsoid.SemiMajorAxis.Value * (this.longitudeOfProjectionCentre - this.lambdaO);
            }
            else
            {
                this.uC = (Math.Abs(this.azimuthOfInitialLine - Math.PI / 2) <= 1E-10) ?
                          this.a * (this.longitudeOfProjectionCentre - this.lambdaO) :
                          (this.a / this.b) * Math.Atan(Math.Sqrt(Math.Max(d * d, 1) - 1) / Math.Cos(this.azimuthOfInitialLine)) * Math.Sign(this.latitudeOfProjectionCentre);
            }

            this.inverseParams = new Double[]
            {
                this.Ellipsoid.EccentricitySquare / 2 + 5 * Math.Pow(this.Ellipsoid.Eccentricity, 4) / 24 + Math.Pow(this.Ellipsoid.Eccentricity, 6) / 12 + 13 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 360,
                7 * Math.Pow(this.Ellipsoid.Eccentricity, 4) / 48 + 29 * Math.Pow(this.Ellipsoid.Eccentricity, 6) / 240 + 811 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 11520,
                7 * Math.Pow(this.Ellipsoid.Eccentricity, 6) / 120 + 81 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 1120,
                4279 * Math.Pow(this.Ellipsoid.Eccentricity, 8) / 161280
            };
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LambertCylindricalEqualAreaEllipsoidalProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The identifier is null.
        /// or
        /// The method is null.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected LambertCylindricalEqualAreaEllipsoidalProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.falseEasting                  = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing                 = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);
            this.longitudeOfNaturalOrigin      = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.latitudeOf1stStandardParallel = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOf1stStandardParallel);

            this.k0 = Math.Cos(this.latitudeOf1stStandardParallel) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Math.Pow(Math.Sin(this.latitudeOf1stStandardParallel), 2));
            this.qP = (1 - this.Ellipsoid.EccentricitySquare) *
                      (Math.Sin(Math.PI / 2) / (1 - this.Ellipsoid.EccentricitySquare * Math.Pow(Math.Sin(Math.PI / 2), 2)) - (1 / (2 * this.Ellipsoid.Eccentricity)) *
                       Math.Log((1 - this.Ellipsoid.Eccentricity * Math.Sin(Math.PI / 2)) / (1 + this.Ellipsoid.Eccentricity * Math.Sin(Math.PI / 2))));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="P6SeismicBinGridTransformation" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="source">The source coordinate reference system.</param>
 /// <param name="target">The target coordinate reference system.</param>
 /// <param name="areaOfUse">The area of use.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The identifier is null.
 /// or
 /// The method is null.
 /// or
 /// The source coordinate reference system is null.
 /// or
 /// The target coordinate reference system is null.
 /// or
 /// The area of use is null.
 /// </exception>
 protected P6SeismicBinGridTransformation(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters,
                                          CoordinateReferenceSystem source, CoordinateReferenceSystem target, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases, method, parameters, source, target, areaOfUse)
 {
     this.binGridOriginI               = this.GetParameterValue(CoordinateOperationParameters.BinGridOriginI);
     this.binGridOriginJ               = this.GetParameterValue(CoordinateOperationParameters.BinGridOriginJ);
     this.binGridOriginEasting         = this.GetParameterValue(CoordinateOperationParameters.BinGridOriginEasting);
     this.binGridOriginNorthing        = this.GetParameterValue(CoordinateOperationParameters.BinGridOriginNorthing);
     this.scaleFactorOfBinGrid         = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorOfBinGrid);
     this.binWidthOnIAxis              = this.GetParameterValue(CoordinateOperationParameters.BinWidthOnIAxis);
     this.binWidthOnJAxis              = this.GetParameterValue(CoordinateOperationParameters.BinWidthOnJAxis);
     this.mapGridBearingOfBinGridJAxis = this.GetParameterBaseValue(CoordinateOperationParameters.MapGridBearingOfBinGridJAxis);
     this.binNodeIncOnIAxis            = this.GetParameterValue(CoordinateOperationParameters.BinNodeIncrementOnIAxis);
     this.binNodeIncOnJAxis            = this.GetParameterValue(CoordinateOperationParameters.BinNodeIncrementOnJAxis);
 }
Esempio n. 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LambertAzimuthalEqualAreaProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected LambertAzimuthalEqualAreaProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            // EPSG Guidance Note number 7, part 2

            this.latitudeOfNaturalOrigin  = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin);
            this.longitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.falseEasting             = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing            = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            this.qP    = (1 - this.Ellipsoid.EccentricitySquare) * ((1 / (1 - this.Ellipsoid.EccentricitySquare)) - ((1 / 2 * this.Ellipsoid.Eccentricity) * Math.Log((1 - this.Ellipsoid.Eccentricity) / (1 + this.Ellipsoid.Eccentricity), Math.E)));
            this.qO    = (1 - this.Ellipsoid.EccentricitySquare) * ((Math.Sin(this.latitudeOfNaturalOrigin) / (1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfNaturalOrigin))) - ((1 / (2 * this.Ellipsoid.Eccentricity)) * Math.Log((1 - this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfNaturalOrigin)) / (1 + this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfNaturalOrigin)), Math.E)));
            this.betaO = Math.Asin(this.qO / this.qP);
            this.RQ    = this.Ellipsoid.SemiMajorAxis.BaseValue * Math.Sqrt(this.qP / 2);
            this.D     = this.Ellipsoid.SemiMajorAxis.BaseValue * (Math.Cos(this.latitudeOfNaturalOrigin) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfNaturalOrigin))) / (this.RQ * Math.Cos(this.betaO));

            if (Math.Abs(this.latitudeOfNaturalOrigin) - Math.Abs(Angles.NorthPole.BaseValue) <= 1E-10)
            {
                this.operationAspect = OperationAspect.NorthPolar;
            }
            else if (Math.Abs(this.latitudeOfNaturalOrigin) - Math.Abs(Angles.SouthPole.BaseValue) <= 1E-10)
            {
                this.operationAspect = OperationAspect.SouthPolar;
            }
            else if (this.Ellipsoid.IsSphere && Math.Abs(this.latitudeOfNaturalOrigin) - Math.Abs(Angles.Equator.BaseValue) <= 1E-10)
            {
                this.operationAspect = OperationAspect.Equatorial;
            }
            else
            {
                this.operationAspect = OperationAspect.Oblique;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CassiniSoldnerProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected CassiniSoldnerProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOfNaturalOrigin  = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin);
            this.longitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.falseEasting             = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing            = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            this.e2 = this.Ellipsoid.EccentricitySquare;
            this.e4 = Math.Pow(this.Ellipsoid.Eccentricity, 4);
            this.e6 = Math.Pow(this.Ellipsoid.Eccentricity, 6);
            this.e8 = Math.Pow(this.Ellipsoid.Eccentricity, 8);
            this.M0 = this.Ellipsoid.SemiMajorAxis.Value * ((1 - this.e2 / 4 - 3 * this.e4 / 64 - 5 * this.e6 / 256) * this.latitudeOfNaturalOrigin -
                                                            (3 * this.e2 / 8 + 3 * this.e4 / 32 + 45 * this.e6 / 1024) * Math.Sin(2 * this.latitudeOfNaturalOrigin) +
                                                            (15 * this.e4 / 256 + 45 * this.e6 / 1024) * Math.Sin(4 * this.latitudeOfNaturalOrigin) -
                                                            35 * this.e6 / 3072 * Math.Sin(6 * this.latitudeOfNaturalOrigin));
        }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CoordinateProjectionData" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="areaOfUse">The area of use.</param>
 public CoordinateProjectionData(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, Dictionary <CoordinateOperationParameter, Object> parameters, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases)
 {
     this.AreaOfUse  = areaOfUse;
     this.Method     = method;
     this.Parameters = parameters;
 }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KrovakProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected KrovakProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOfProjectionCentre          = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfProjectionCentre);
            this.longitudeOfOrigin                   = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfOrigin);
            this.coLatitudeOfConeAxis                = this.GetParameterBaseValue(CoordinateOperationParameters.CoLatitudeOfConeAxis);
            this.latitudeOfPseudoStandardParallel    = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfPseudoStandardParallel);
            this.scaleFactorOnPseudoStandardParallel = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorOnPseudoStandardParallel);
            this.falseEasting  = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            this.A      = this.Ellipsoid.SemiMajorAxis.BaseValue * Math.Pow(1 - this.Ellipsoid.EccentricitySquare, 0.5) / (1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfProjectionCentre));
            this.B      = Math.Pow(1 + ((this.Ellipsoid.EccentricitySquare * Calculator.Cos4(this.latitudeOfProjectionCentre)) / (1 - this.Ellipsoid.EccentricitySquare)), 0.5);
            this.gammaO = Math.Asin(Math.Sin(this.latitudeOfProjectionCentre) / this.B);
            this.tO     = Math.Tan(Math.PI / 4 + this.gammaO / 2) * Math.Pow((1 + this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)) / (1 - this.Ellipsoid.Eccentricity * Math.Sin(this.latitudeOfProjectionCentre)), this.Ellipsoid.Eccentricity * this.B / 2) / Math.Pow(Math.Tan(Math.PI / 4 + this.latitudeOfProjectionCentre / 2), this.B);
            this.n      = Math.Sin(this.latitudeOfPseudoStandardParallel);
            this.rO     = this.scaleFactorOnPseudoStandardParallel * this.A / Math.Tan(this.latitudeOfPseudoStandardParallel);
        }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PolarStereographicProjection" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="ellipsoid">The ellipsoid.</param>
 /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The identifier is null.
 /// or
 /// The method is null.
 /// or
 /// The ellipsoid is null.
 /// or
 /// The area of use is null.
 /// </exception>
 protected PolarStereographicProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
 {
 }
        /// <summary>
        /// Returns the item with the specified properties.
        /// </summary>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="source">The source coordinate reference system.</param>
        /// <param name="target">The target coordinate reference system.</param>
        /// <param name="areaOfUse">The area of use.</param>
        /// <returns>The instance with the specified properties.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The source coordinate reference system is null.
        /// or
        /// The target coordinate reference system is null.
        /// or
        /// The area of use is null.
        /// </exception>
        public IEnumerable <CoordinateTransformation <CoordinateType> > WithProperties(CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, CoordinateReferenceSystem source, CoordinateReferenceSystem target, AreaOfUse areaOfUse)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (areaOfUse == null)
            {
                throw new ArgumentNullException(nameof(areaOfUse));
            }

            this.EnsureOperationTypes();

            return(this.dataCollection.Where(data => this.transformationTypes.ContainsKey(data.Method.Code)).Where(data => data.Method.Equals(method) && data.Collection.Equals(source) && data.Target.Equals(target) && data.AreaOfUse.Equals(areaOfUse) && this.IsMatching(data.Parameters, parameters)).Select(data => this.CreateTransformation(data)));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LambertConicConformal2SPProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected LambertConicConformal2SPProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOfFalseOrigin         = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfFalseOrigin);
            this.longitudeOfFalseOrigin        = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfFalseOrigin);
            this.latitudeOf1stStandardParallel = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOf1stStandardParallel);
            this.latitudeOf2ndStandardParallel = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOf2ndStandardParallel);
            this.eastingAtFalseOrigin          = this.GetParameterValue(CoordinateOperationParameters.EastingAtFalseOrigin);
            this.northingAtFalseOrigin         = this.GetParameterValue(CoordinateOperationParameters.NorthingAtFalseOrigin);

            Double m1 = Math.Cos(this.latitudeOf1stStandardParallel) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOf1stStandardParallel));
            Double m2 = Math.Cos(this.latitudeOf2ndStandardParallel) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOf2ndStandardParallel));
            Double t1 = this.ComputeTValue(this.latitudeOf1stStandardParallel);
            Double t2 = this.ComputeTValue(this.latitudeOf2ndStandardParallel);

            this.n = (Math.Log(m1) - Math.Log(m2)) / (Math.Log(t1) - Math.Log(t2));
            this.f = m1 / (this.n * Math.Pow(t1, this.n));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CoordinateTransformationData" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="source">The source coordinate reference system.</param>
 /// <param name="target">The target coordinate reference system.</param>
 /// <param name="areaOfUse">The area of use.</param>
 public CoordinateTransformationData(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, Dictionary <CoordinateOperationParameter, Object> parameters, CoordinateReferenceSystem source, CoordinateReferenceSystem target, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases)
 {
     this.AreaOfUse  = areaOfUse;
     this.Method     = method;
     this.Parameters = parameters;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LambertConicConformalProjection" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="ellipsoid">The ellipsoid.</param>
 /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The method is null.
 /// or
 /// The defined operation method requires parameters.
 /// or
 /// The ellipsoid is null.
 /// or
 /// The area of use is null.
 /// </exception>
 protected LambertConicConformalProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
 {
 }
Esempio n. 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BonneProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected BonneProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.falseEasting             = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing            = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);
            this.latitudeOfNaturalOrigin  = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin);
            this.longitudeOfNaturalOrigin = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);

            this.e4 = Math.Pow(this.Ellipsoid.Eccentricity, 4);
            this.e6 = Math.Pow(this.Ellipsoid.Eccentricity, 6);
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KrovakModifiedProjection" /> class.
 /// </summary>
 /// <param name="identifier">The identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="remarks">The remarks.</param>
 /// <param name="aliases">The aliases.</param>
 /// <param name="method">The coordinate operation method.</param>
 /// <param name="parameters">The parameters of the operation.</param>
 /// <param name="ellipsoid">The ellipsoid.</param>
 /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The method is null.
 /// or
 /// The ellipsoid is null.
 /// or
 /// The area of use is null.
 /// </exception>
 protected KrovakModifiedProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
     : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
 {
     this.ordinate1OfEvaluationPoint = this.GetParameterValue(CoordinateOperationParameters.Ordinate1OfEvaluationPoint);
     this.ordinate2OfEvaluationPoint = this.GetParameterValue(CoordinateOperationParameters.Ordinate2OfEvaluationPoint);
     this.C1  = this.GetParameterValue(CoordinateOperationParameters.C1);
     this.C2  = this.GetParameterValue(CoordinateOperationParameters.C2);
     this.C3  = this.GetParameterValue(CoordinateOperationParameters.C3);
     this.C4  = this.GetParameterValue(CoordinateOperationParameters.C4);
     this.C5  = this.GetParameterValue(CoordinateOperationParameters.C5);
     this.C6  = this.GetParameterValue(CoordinateOperationParameters.C6);
     this.C7  = this.GetParameterValue(CoordinateOperationParameters.C7);
     this.C8  = this.GetParameterValue(CoordinateOperationParameters.C8);
     this.C9  = this.GetParameterValue(CoordinateOperationParameters.C9);
     this.C10 = this.GetParameterValue(CoordinateOperationParameters.C10);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="LambertConicConformal1SPProjection" /> class.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="method">The coordinate operation method.</param>
        /// <param name="parameters">The parameters of the operation.</param>
        /// <param name="ellipsoid">The ellipsoid.</param>
        /// <param name="areaOfUse">The area of use where the operation is applicable.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The method is null.
        /// or
        /// The defined operation method requires parameters.
        /// or
        /// The ellipsoid is null.
        /// or
        /// The area of use is null.
        /// </exception>
        protected LambertConicConformal1SPProjection(String identifier, String name, String remarks, String[] aliases, CoordinateOperationMethod method, IDictionary <CoordinateOperationParameter, Object> parameters, Ellipsoid ellipsoid, AreaOfUse areaOfUse)
            : base(identifier, name, remarks, aliases, method, parameters, ellipsoid, areaOfUse)
        {
            this.latitudeOfNaturalOrigin    = this.GetParameterBaseValue(CoordinateOperationParameters.LatitudeOfNaturalOrigin);
            this.longitudeOfNaturalOrigin   = this.GetParameterBaseValue(CoordinateOperationParameters.LongitudeOfNaturalOrigin);
            this.scaleFactorAtNaturalOrigin = this.GetParameterValue(CoordinateOperationParameters.ScaleFactorAtNaturalOrigin);
            this.falseEasting  = this.GetParameterValue(CoordinateOperationParameters.FalseEasting);
            this.falseNorthing = this.GetParameterValue(CoordinateOperationParameters.FalseNorthing);

            Double m0 = Math.Cos(this.latitudeOfNaturalOrigin) / Math.Sqrt(1 - this.Ellipsoid.EccentricitySquare * Calculator.Sin2(this.latitudeOfNaturalOrigin));
            Double t0 = this.ComputeTValue(this.latitudeOfNaturalOrigin);

            this.n  = Math.Sin(this.latitudeOfNaturalOrigin);
            this.f  = m0 / (this.n * Math.Pow(t0, this.n));
            this.r0 = this.Ellipsoid.SemiMajorAxis.Value * this.f * Math.Pow(t0, this.n) * this.scaleFactorAtNaturalOrigin;
        }