Exemplo n.º 1
0
        private static void ApplyParametersStere(ProjectionInfo result, IEnumerable <INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector(),
                new LongitudeOfCenterParameterSelector());
            var spParam = new MultiParameterSelector(
                new LatitudeOfTrueScaleParameterSelector(),
                new StandardParallelParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfCenterParameterSelector());
            var k0Param = new ScaleFactorParameterSelector();
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();

            var paramLookup = new NamedParameterLookup(parameters);

            paramLookup.Assign(lon0Param, spParam, k0Param, x0Param, y0Param);

            if (lon0Param.IsSelected)
            {
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (spParam.IsSelected)
            {
                result.StandardParallel1 = spParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (k0Param.IsSelected)
            {
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            }
            if (x0Param.IsSelected)
            {
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (y0Param.IsSelected)
            {
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }

            if (!result.LatitudeOfOrigin.HasValue && result.StandardParallel1.HasValue)
            {
                result.LatitudeOfOrigin = result.StandardParallel1.GetValueOrDefault() >= 0 ? 90.0 : -90.0;
            }
        }
Exemplo n.º 2
0
        private static void ApplyParametersDefault(ProjectionInfo result, IEnumerable<INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector()
            );
            var loncParam = new LongitudeOfCenterParameterSelector();
            var lat0Param = new MultiParameterSelector(
                new LatitudeOfCenterParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector());
            var lat1Param = new StandardParallelParameterSelector(1);
            var lat2Param = new StandardParallelParameterSelector(2);
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();
            var k0Param = new ScaleFactorParameterSelector();
            var alphaParam = new KeywordNamedParameterSelector("ALPHA", "AZIMUTH");
            var angleSkewParam = new KeywordNamedParameterSelector("SKEW", "GAMMA");
            var zoneParam = new FullMatchParameterSelector("ZONE");
            var southParam = new FullMatchParameterSelector("SOUTH");
            var standardParallel1Param = new MultiParameterSelector(
                new StandardParallelParameterSelector(),
                new StandardParallelParameterSelector(1));
            var standardParallel2Param = new StandardParallelParameterSelector(2);

            var paramLookup = new NamedParameterLookup(parameters);
            paramLookup.Assign(lon0Param, loncParam, lat0Param, lat1Param, lat2Param, x0Param, y0Param, k0Param, alphaParam, angleSkewParam, zoneParam, southParam, standardParallel1Param, standardParallel2Param);

            if (lon0Param.IsSelected)
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (loncParam.IsSelected)
                result.LongitudeOfCenter = loncParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat0Param.IsSelected)
                result.LatitudeOfOrigin = lat0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat1Param.IsSelected)
                result.StandardParallel1 = lat1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (lat2Param.IsSelected)
                result.StandardParallel2 = lat2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (x0Param.IsSelected)
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (y0Param.IsSelected)
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (k0Param.IsSelected)
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            if (alphaParam.IsSelected)
                result.alpha = alphaParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            /*if (angleSkewParam.IsSelected)
                result.gamma = angleSkewParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);*/
            if (southParam.IsSelected)
                result.IsSouth = southParam.GetValueAsBoolean().GetValueOrDefault();
            if (standardParallel1Param.IsSelected)
                result.StandardParallel1 = standardParallel1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (standardParallel2Param.IsSelected)
                result.StandardParallel2 = standardParallel2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (zoneParam.IsSelected)
                result.Zone = zoneParam.GetValueAsInt32();
        }
Exemplo n.º 3
0
        public static ProjectionInfo CreateProjection(ICrsProjected crsProjected)
        {
            if (crsProjected == null) throw new ArgumentNullException("crsProjected");
            Contract.Ensures(Contract.Result<ProjectionInfo>() != null);

            var result = ProjectionInfo.FromProj4String(String.Empty);

            result.Name = crsProjected.Name;

            if (crsProjected.Authority != null) {
                int epsgCode;
                if (crsProjected.Authority.Name == "EPSG" && Int32.TryParse(crsProjected.Authority.Code, out epsgCode))
                    result.EpsgCode = epsgCode;

                result.Authority = crsProjected.Authority.Name;
            }

            var geographicBase = (crsProjected.BaseCrs as ICrsGeodetic) ?? (crsProjected as ICrsGeodetic);
            if (geographicBase != null)
                result.GeographicInfo = Proj4CrsGeographic.CreateGeographic(geographicBase);

            var projectionInfo = crsProjected.Projection as IParameterizedCoordinateOperationInfo;

            if (projectionInfo == null)
                return result;

            var projectionMethod = projectionInfo.Method;
            if(projectionMethod == null)
                throw new InvalidOperationException("No projection method.");

            var proj4Name = ToProj4MethodName(projectionMethod.Name);

            IUnit geographicUnit = geographicBase == null ? null : geographicBase.Unit;
            IUnit projectionUnit = crsProjected.Unit;
            if (projectionUnit != null)
                result.Unit = Proj4LinearUnit.ConvertToProj4(projectionUnit);
            switch (proj4Name) {
                case "stere":
                    ApplyParametersStere(result, projectionInfo.Parameters);
                    break;
                default:
                    ApplyParametersDefault(result, projectionInfo.Parameters);
                    break;
            }

            if (result.Zone.HasValue && proj4Name == "tmerc")
                proj4Name = "utm";

            if (!TransformManager.Transforms.Exists(x => x.Proj4Name == proj4Name)) {
                if (GeodeticOperationNameRegex.IsMatch(proj4Name)) {
                    proj4Name = "longlat";
                }
                else {
                    throw new InvalidOperationException();
                }
            }

            switch (proj4Name) {
                case "omerc": {

                    var offsetXParam = new FalseEastingParameterSelector();
                    var offsetYParam = new FalseNorthingParameterSelector();
                    var xAtOriginParam = new EastingAtCenterParameterSelector();
                    var yAtOriginParam = new NorthingAtCenterParameterSelector();
                    var paramLookup = new NamedParameterLookup(projectionInfo.Parameters);
                    paramLookup.Assign(offsetXParam, offsetYParam, xAtOriginParam, yAtOriginParam);

                    if (offsetXParam.IsSelected || offsetYParam.IsSelected)
                        result.Transform = TransformManager.GetProjection("Hotine_Oblique_Mercator_Azimuth_Center");
                    else if(xAtOriginParam.IsSelected || yAtOriginParam.IsSelected)
                        result.Transform = TransformManager.GetProjection("Hotine_Oblique_Mercator_Azimuth_Natural_Origin");
                    else
                        result.Transform = TransformManager.GetProj4(proj4Name);

                    break;
                }
                default:
                    result.Transform = TransformManager.GetProj4(proj4Name);
                    break;
            }

            var finalResult = ProjectionInfo.FromProj4String(result.ToProj4String()); // TODO: fix this hack
            /*finalResult.CentralMeridian = result.CentralMeridian;
            finalResult.LongitudeOfCenter = result.LongitudeOfCenter;
            finalResult.LatitudeOfOrigin = result.LatitudeOfOrigin;
            finalResult.StandardParallel1 = result.StandardParallel1;
            finalResult.StandardParallel2 = result.StandardParallel2;
            finalResult.FalseEasting = result.FalseEasting;
            finalResult.FalseNorthing = result.FalseNorthing;
            finalResult.ScaleFactor = result.ScaleFactor;
            finalResult.alpha = result.alpha;
            finalResult.IsSouth = result.IsSouth;
            finalResult.Zone = result.Zone;
            finalResult.Unit = result.Unit;
            if (result.GeographicInfo == null) { // NOTE: this is all so terrible
                finalResult.GeographicInfo = null;
            }
            else {
                if (finalResult.GeographicInfo == null) {
                    finalResult.GeographicInfo = result.GeographicInfo;
                }
                else {
                    finalResult.GeographicInfo.Datum.Spheroid = result.GeographicInfo.Datum.Spheroid;
                }
            }*/
            return finalResult;
        }
        private SpheroidProjectionBase CreatePolarStereographic(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var latParam = new MultiParameterSelector(
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfTrueScaleParameterSelector());
            var originLonParam = new MultiParameterSelector(
                new LongitudeOfNaturalOriginParameterSelector(),
                new FullMatchParameterSelector("LONDOWNFROMPOLE"));// new KeywordNamedParameterSelector("LON", "ORIGIN");
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var standardParallelParam = new StandardParallelParameterSelector();
            var scaleFactorParam = new ScaleFactorParameterSelector();
            opData.ParameterLookup.Assign(latParam, originLonParam, offsetXParam, offsetYParam, standardParallelParam, scaleFactorParam);

            var linearUnit = opData.StepParams.RelatedOutputCrsUnit;

            var fromSpheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(linearUnit);
            if (null == fromSpheroid)
                return null;

            double latitude, longitude;
            if (!latParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out latitude))
                latitude = 0;
            if (!originLonParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out longitude))
                longitude = 0;

            double xOffset, yOffset;
            var offset = (offsetXParam.TryGetValueAsDouble(linearUnit, out xOffset) && offsetYParam.TryGetValueAsDouble(linearUnit, out yOffset))
                ? new Vector2(xOffset, yOffset)
                : Vector2.Zero;

            double scaleFactor;
            if (scaleFactorParam.TryGetValueAsDouble(ScaleUnitUnity.Value, out scaleFactor))
                return new PolarStereographic(new GeographicCoordinate(latitude,longitude), scaleFactor, offset, fromSpheroid);

            double standardParallel;
            if (standardParallelParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out standardParallel)) {
                if (
                    (offsetXParam.IsSelected && opData.ParameterLookup.ParameterNameNormalizedComparer.Normalize(offsetXParam.Selection.Name).Contains("ORIGIN"))
                    || (offsetYParam.IsSelected && opData.ParameterLookup.ParameterNameNormalizedComparer.Normalize(offsetYParam.Selection.Name).Contains("ORIGIN"))
                ) {
                    return PolarStereographic.CreateFromStandardParallelAndFalseOffsetAtOrigin(longitude, standardParallel, offset, fromSpheroid);
                }
                return PolarStereographic.CreateFromStandardParallel(longitude, standardParallel, offset, fromSpheroid);
            }

            throw new InvalidOperationException();
        }
        private SpheroidProjectionBase CreateObliqueStereographic(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new LatitudeOfNaturalOriginParameterSelector();
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var scaleFactorParam = new ScaleFactorParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            double scaleFactor;
            if (scaleFactorParam.IsSelected && TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor))
                return new ObliqueStereographic(origin, scaleFactor, offset, spheroid);

            return null;
        }
        private ITransformation<GeographicCoordinate, Point2> CreateMercator(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new MultiParameterSelector(
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfTrueScaleParameterSelector(),
                new StandardParallelParameterSelector());
            var originLonParam = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector());
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var scaleFactorParam = new ScaleFactorParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            // ReSharper disable CompareOfFloatsByEqualityOperator
            double scaleFactor;
            if (scaleFactorParam.IsSelected && TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor)) {
                if (1 == scaleFactor && 0 == spheroid.E)
                    return new MercatorSpherical(offset, origin.Longitude, spheroid.A);
                return new Mercator(origin.Longitude, scaleFactor, offset, spheroid);
            }

            if (0 == spheroid.E)
                return new MercatorSpherical(offset, origin.Longitude, spheroid.A);
            return new Mercator(origin, offset, spheroid);
            // ReSharper restore CompareOfFloatsByEqualityOperator
        }
        private static PopularVisualizationPseudoMercator CreatePopularVisualisationPseudoMercator(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new LatitudeOfNaturalOriginParameterSelector();
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            if (!opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam))
                return null;

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            Vector2 offset;

            TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin);
            TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset);
            return new PopularVisualizationPseudoMercator(origin, offset, spheroid);
        }
Exemplo n.º 8
0
        private static void ApplyParametersDefault(ProjectionInfo result, IEnumerable <INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector()
                );
            var loncParam = new LongitudeOfCenterParameterSelector();
            var lat0Param = new MultiParameterSelector(
                new LatitudeOfCenterParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector());
            var lat1Param              = new StandardParallelParameterSelector(1);
            var lat2Param              = new StandardParallelParameterSelector(2);
            var x0Param                = new FalseEastingParameterSelector();
            var y0Param                = new FalseNorthingParameterSelector();
            var k0Param                = new ScaleFactorParameterSelector();
            var alphaParam             = new KeywordNamedParameterSelector("ALPHA", "AZIMUTH");
            var angleSkewParam         = new KeywordNamedParameterSelector("SKEW", "GAMMA");
            var zoneParam              = new FullMatchParameterSelector("ZONE");
            var southParam             = new FullMatchParameterSelector("SOUTH");
            var standardParallel1Param = new MultiParameterSelector(
                new StandardParallelParameterSelector(),
                new StandardParallelParameterSelector(1));
            var standardParallel2Param = new StandardParallelParameterSelector(2);

            var paramLookup = new NamedParameterLookup(parameters);

            paramLookup.Assign(lon0Param, loncParam, lat0Param, lat1Param, lat2Param, x0Param, y0Param, k0Param, alphaParam, angleSkewParam, zoneParam, southParam, standardParallel1Param, standardParallel2Param);

            if (lon0Param.IsSelected)
            {
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (loncParam.IsSelected)
            {
                result.LongitudeOfCenter = loncParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat0Param.IsSelected)
            {
                result.LatitudeOfOrigin = lat0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat1Param.IsSelected)
            {
                result.StandardParallel1 = lat1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (lat2Param.IsSelected)
            {
                result.StandardParallel2 = lat2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (x0Param.IsSelected)
            {
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (y0Param.IsSelected)
            {
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            }
            if (k0Param.IsSelected)
            {
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            }
            if (alphaParam.IsSelected)
            {
                result.alpha = alphaParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }

            /*if (angleSkewParam.IsSelected)
             *  result.gamma = angleSkewParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);*/
            if (southParam.IsSelected)
            {
                result.IsSouth = southParam.GetValueAsBoolean().GetValueOrDefault();
            }
            if (standardParallel1Param.IsSelected)
            {
                result.StandardParallel1 = standardParallel1Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (standardParallel2Param.IsSelected)
            {
                result.StandardParallel2 = standardParallel2Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            }
            if (zoneParam.IsSelected)
            {
                result.Zone = zoneParam.GetValueAsInt32();
            }
        }
        private SpheroidProjectionBase CreateLabordeObliqueMercator(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new KeywordNamedParameterSelector("LAT", "CENTER");
            var originLonParam = new KeywordNamedParameterSelector("LON", "CENTER");
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var scaleFactorParam = new ScaleFactorParameterSelector();
            var azimuthParam = new KeywordNamedParameterSelector("AZIMUTH");
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam, azimuthParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            double scaleFactor;
            if (!scaleFactorParam.IsSelected || !TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor))
                scaleFactor = 1.0;

            double azimuth;
            if (!azimuthParam.IsSelected || !TryGetDouble(azimuthParam.Selection, OgcAngularUnit.DefaultRadians, out azimuth))
                azimuth = 0;

            return new LabordeObliqueMercator(origin, azimuth, scaleFactor, spheroid, offset);
        }
        private ITransformation<GeographicCoordinate, Point2> CreateKrovak(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var latConeAxisParam = new KeywordNamedParameterSelector("CO", "LAT", "CONE", "AXIS"); // Co-latitude of cone axis
            var latProjectionCenterParam = new KeywordNamedParameterSelector("LAT", "CENTER"); // Latitude of projection centre
            var latPseudoParallelParam = new KeywordNamedParameterSelector("LAT", "PSEUDO", "PARALLEL"); // Latitude of pseudo standard parallel
            var scaleFactorParallelParam = new KeywordNamedParameterSelector("SCALE", "PARALLEL"); // Scale factor on pseudo standard parallel
            var originLonParam = new KeywordNamedParameterSelector("LON", "ORIGIN"); // Longitude of origin
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var evalXParam = new KeywordNamedParameterSelector("ORDINATE1", "EVALUATION", "POINT");
            var evalYParam = new KeywordNamedParameterSelector("ORDINATE2", "EVALUATION", "POINT");
            opData.ParameterLookup.Assign(latConeAxisParam, latProjectionCenterParam, latPseudoParallelParam, scaleFactorParallelParam, originLonParam, offsetXParam, offsetYParam, evalXParam, evalYParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!latProjectionCenterParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(latProjectionCenterParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset))
                offset = Vector2.Zero;

            Point2 evalPoint;
            if (!evalXParam.IsSelected || !evalYParam.IsSelected || !TryCreatePoint2(evalXParam.Selection, evalYParam.Selection, out evalPoint))
                evalPoint = Point2.Zero;

            double azimuthOfInitialLine;
            if (!latConeAxisParam.IsSelected || !TryGetDouble(latConeAxisParam.Selection, OgcAngularUnit.DefaultRadians, out azimuthOfInitialLine))
                azimuthOfInitialLine = Double.NaN;

            double latitudeOfPseudoStandardParallel;
            if (!latPseudoParallelParam.IsSelected || !TryGetDouble(latPseudoParallelParam.Selection, OgcAngularUnit.DefaultRadians, out latitudeOfPseudoStandardParallel))
                latitudeOfPseudoStandardParallel = Double.NaN;

            double scaleFactor;
            if (!scaleFactorParallelParam.IsSelected || !TryGetDouble(scaleFactorParallelParam.Selection, ScaleUnitUnity.Value, out scaleFactor))
                scaleFactor = Double.NaN;

            var normalizedName = _coordinateOperationNameComparer.Normalize(opData.OperationName);

            double[] constants = null;
            if (normalizedName.StartsWith("KROVAKMODIFIED")) {
                var constantParams = new NamedParameterSelector[] {
                    new FullMatchParameterSelector("C1"),
                    new FullMatchParameterSelector("C2"),
                    new FullMatchParameterSelector("C3"),
                    new FullMatchParameterSelector("C4"),
                    new FullMatchParameterSelector("C5"),
                    new FullMatchParameterSelector("C6"),
                    new FullMatchParameterSelector("C7"),
                    new FullMatchParameterSelector("C8"),
                    new FullMatchParameterSelector("C9"),
                    new FullMatchParameterSelector("C10")
                };
                if (opData.ParameterLookup.Assign(constantParams)) {
                    constants = constantParams
                        .OrderBy(x => Int32.Parse(x.Selection.Name.Substring(1)))
                        .Select(p => {
                            double value;
                            TryGetDouble(p.Selection, ScaleUnitUnity.Value, out value);
                            return value;
                        })
                        .ToArray();
                    Contract.Assume(constants.Length == constantParams.Length);
                }
            }

            if (normalizedName.Equals("KROVAKNORTH")) {
                return new KrovakNorth(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid);
            }
            if (null != constants) {
                if (normalizedName.Equals("KROVAKMODIFIED")) {
                    return new KrovakModified(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid, evalPoint, constants);
                }
                if (normalizedName.Equals("KROVAKMODIFIEDNORTH")) {
                    return new KrovakModifiedNorth(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid, evalPoint, constants);
                }
            }

            return new Krovak(origin, latitudeOfPseudoStandardParallel, azimuthOfInitialLine, scaleFactor, offset, spheroid);
        }
        private SpheroidProjectionBase CreateHotineObliqueMercator(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);

            var latParam = new MultiParameterSelector(
                new LatitudeOfCenterParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector());
            var lonParam = new MultiParameterSelector(
                new LongitudeOfCenterParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector());

            var scaleFactorParam = new ScaleFactorParameterSelector();
            var azimuthParam = new KeywordNamedParameterSelector("AZIMUTH");
            var angleSkewParam = new KeywordNamedParameterSelector("ANGLE", "SKEW");

            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var xAtOriginParam = new EastingAtCenterParameterSelector();
            var yAtOriginParam = new NorthingAtCenterParameterSelector();

            opData.ParameterLookup.Assign(latParam, lonParam, offsetXParam, offsetYParam, xAtOriginParam, yAtOriginParam, scaleFactorParam, azimuthParam, angleSkewParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            double lat, lon;
            if(!latParam.IsSelected || !latParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out lat))
                lat = 0;
            if(!lonParam.IsSelected || !lonParam.TryGetValueAsDouble(OgcAngularUnit.DefaultRadians, out lon))
                lon = 0;
            var origin = new GeographicCoordinate(lat, lon);

            double scaleFactor;
            if (!scaleFactorParam.IsSelected || !TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor))
                scaleFactor = 1.0;

            double azimuth;
            if (!azimuthParam.IsSelected || !TryGetDouble(azimuthParam.Selection, OgcAngularUnit.DefaultRadians, out azimuth))
                azimuth = 0;

            double angleSkew;
            if (!angleSkewParam.IsSelected || !TryGetDouble(angleSkewParam.Selection, OgcAngularUnit.DefaultRadians, out angleSkew))
                angleSkew = 0;

            var outputUnit = opData.StepParams.RelatedOutputCrsUnit;
            double x,y;
            if(xAtOriginParam.IsSelected || yAtOriginParam.IsSelected){
                if (!xAtOriginParam.IsSelected || !xAtOriginParam.TryGetValueAsDouble(outputUnit, out x))
                    x = 0;
                if (!yAtOriginParam.IsSelected || !yAtOriginParam.TryGetValueAsDouble(outputUnit, out y))
                    y = 0;
                return new HotineObliqueMercator.VariantB(new GeographicCoordinate(lat, lon), azimuth, angleSkew, scaleFactor, new Vector2(x,y), spheroid);
            }
            else {
                if (!offsetXParam.IsSelected || !offsetXParam.TryGetValueAsDouble(outputUnit, out x))
                    x = 0;
                if (!offsetYParam.IsSelected || !offsetYParam.TryGetValueAsDouble(outputUnit, out y))
                    y = 0;
                return new HotineObliqueMercator.VariantA(new GeographicCoordinate(lat, lon), azimuth, angleSkew, scaleFactor, new Vector2(x,y), spheroid);
            }
        }
        private SpheroidProjectionBase CreateEquidistantCylindrical(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new KeywordNamedParameterSelector("LAT", "PARALLEL");
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!originLatParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset))
                offset = Vector2.Zero;

            // ReSharper disable CompareOfFloatsByEqualityOperator
            var spherical = _coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("SPHERICAL")
                || spheroid.E == 0;
            // ReSharper restore CompareOfFloatsByEqualityOperator

            return spherical
                ? (SpheroidProjectionBase)new EquidistantCylindricalSpherical(origin, offset, spheroid)
                : new EquidistantCylindrical(origin, offset, spheroid);
        }
        private ITransformation<GeographicCoordinate, Point2> CreateCassiniSoldner(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new LatitudeOfNaturalOriginParameterSelector();
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            return new CassiniSoldner(origin, offset, spheroid);
        }
        private AlbersEqualArea CreateAlbersEqualArea(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new MultiParameterSelector(
                new LatitudeOfFalseOrigin(),
                new LatitudeOfNaturalOriginParameterSelector());
            var originLonParam = new MultiParameterSelector(
                new LongitudeOfFalseOrigin(),
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector(),
                new LongitudeOfCenterParameterSelector());
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var lat1SpParam = new StandardParallelParameterSelector(1);
            var lat2SpParam = new StandardParallelParameterSelector(2);
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, lat1SpParam, lat2SpParam);

            var fromSpheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == fromSpheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            double parallel1;
            if (!lat1SpParam.IsSelected || !TryGetDouble(lat1SpParam.Selection, OgcAngularUnit.DefaultRadians, out parallel1))
                parallel1 = 0;

            double parallel2;
            if (!lat2SpParam.IsSelected || !TryGetDouble(lat2SpParam.Selection, OgcAngularUnit.DefaultRadians, out parallel2))
                parallel2 = 0;

            return new AlbersEqualArea(origin, parallel1, parallel2, offset, fromSpheroid);
        }
Exemplo n.º 15
0
        private static void ApplyParametersStere(ProjectionInfo result, IEnumerable<INamedParameter> parameters)
        {
            Contract.Requires(result != null);
            Contract.Requires(parameters != null);
            var lon0Param = new MultiParameterSelector(
                new CentralMeridianParameterSelector(),
                new LongitudeOfNaturalOriginParameterSelector(),
                new LongitudeOfCenterParameterSelector());
            var spParam = new MultiParameterSelector(
                new LatitudeOfTrueScaleParameterSelector(),
                new StandardParallelParameterSelector(),
                new LatitudeOfNaturalOriginParameterSelector(),
                new LatitudeOfCenterParameterSelector());
            var k0Param = new ScaleFactorParameterSelector();
            var x0Param = new FalseEastingParameterSelector();
            var y0Param = new FalseNorthingParameterSelector();

            var paramLookup = new NamedParameterLookup(parameters);
            paramLookup.Assign(lon0Param, spParam, k0Param, x0Param, y0Param);

            if (lon0Param.IsSelected)
                result.CentralMeridian = lon0Param.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (spParam.IsSelected)
                result.StandardParallel1 = spParam.GetValueAsDouble(OgcAngularUnit.DefaultDegrees);
            if (k0Param.IsSelected)
                result.ScaleFactor = k0Param.GetValueAsDouble(ScaleUnitUnity.Value) ?? 1.0;
            if (x0Param.IsSelected)
                result.FalseEasting = x0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);
            if (y0Param.IsSelected)
                result.FalseNorthing = y0Param.GetValueAsDouble(OgcLinearUnit.DefaultMeter);

            if (!result.LatitudeOfOrigin.HasValue && result.StandardParallel1.HasValue)
                result.LatitudeOfOrigin = result.StandardParallel1.GetValueOrDefault() >= 0 ? 90.0 : -90.0;
        }
Exemplo n.º 16
0
        public static ProjectionInfo CreateProjection(ICrsProjected crsProjected)
        {
            if (crsProjected == null)
            {
                throw new ArgumentNullException("crsProjected");
            }
            Contract.Ensures(Contract.Result <ProjectionInfo>() != null);

            var result = ProjectionInfo.FromProj4String(String.Empty);

            result.Name = crsProjected.Name;

            if (crsProjected.Authority != null)
            {
                int epsgCode;
                if (crsProjected.Authority.Name == "EPSG" && Int32.TryParse(crsProjected.Authority.Code, out epsgCode))
                {
                    result.EpsgCode = epsgCode;
                }

                result.Authority = crsProjected.Authority.Name;
            }

            var geographicBase = (crsProjected.BaseCrs as ICrsGeodetic) ?? (crsProjected as ICrsGeodetic);

            if (geographicBase != null)
            {
                result.GeographicInfo = Proj4CrsGeographic.CreateGeographic(geographicBase);
            }


            var projectionInfo = crsProjected.Projection as IParameterizedCoordinateOperationInfo;

            if (projectionInfo == null)
            {
                return(result);
            }

            var projectionMethod = projectionInfo.Method;

            if (projectionMethod == null)
            {
                throw new InvalidOperationException("No projection method.");
            }

            var proj4Name = ToProj4MethodName(projectionMethod.Name);

            IUnit geographicUnit = geographicBase == null ? null : geographicBase.Unit;
            IUnit projectionUnit = crsProjected.Unit;

            if (projectionUnit != null)
            {
                result.Unit = Proj4LinearUnit.ConvertToProj4(projectionUnit);
            }
            switch (proj4Name)
            {
            case "stere":
                ApplyParametersStere(result, projectionInfo.Parameters);
                break;

            default:
                ApplyParametersDefault(result, projectionInfo.Parameters);
                break;
            }

            if (result.Zone.HasValue && proj4Name == "tmerc")
            {
                proj4Name = "utm";
            }

            if (!TransformManager.Transforms.Exists(x => x.Proj4Name == proj4Name))
            {
                if (GeodeticOperationNameRegex.IsMatch(proj4Name))
                {
                    proj4Name = "longlat";
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }

            switch (proj4Name)
            {
            case "omerc": {
                var offsetXParam   = new FalseEastingParameterSelector();
                var offsetYParam   = new FalseNorthingParameterSelector();
                var xAtOriginParam = new EastingAtCenterParameterSelector();
                var yAtOriginParam = new NorthingAtCenterParameterSelector();
                var paramLookup    = new NamedParameterLookup(projectionInfo.Parameters);
                paramLookup.Assign(offsetXParam, offsetYParam, xAtOriginParam, yAtOriginParam);

                if (offsetXParam.IsSelected || offsetYParam.IsSelected)
                {
                    result.Transform = TransformManager.GetProjection("Hotine_Oblique_Mercator_Azimuth_Center");
                }
                else if (xAtOriginParam.IsSelected || yAtOriginParam.IsSelected)
                {
                    result.Transform = TransformManager.GetProjection("Hotine_Oblique_Mercator_Azimuth_Natural_Origin");
                }
                else
                {
                    result.Transform = TransformManager.GetProj4(proj4Name);
                }

                break;
            }

            default:
                result.Transform = TransformManager.GetProj4(proj4Name);
                break;
            }

            var finalResult = ProjectionInfo.FromProj4String(result.ToProj4String()); // TODO: fix this hack

            /*finalResult.CentralMeridian = result.CentralMeridian;
             * finalResult.LongitudeOfCenter = result.LongitudeOfCenter;
             * finalResult.LatitudeOfOrigin = result.LatitudeOfOrigin;
             * finalResult.StandardParallel1 = result.StandardParallel1;
             * finalResult.StandardParallel2 = result.StandardParallel2;
             * finalResult.FalseEasting = result.FalseEasting;
             * finalResult.FalseNorthing = result.FalseNorthing;
             * finalResult.ScaleFactor = result.ScaleFactor;
             * finalResult.alpha = result.alpha;
             * finalResult.IsSouth = result.IsSouth;
             * finalResult.Zone = result.Zone;
             * finalResult.Unit = result.Unit;
             * if (result.GeographicInfo == null) { // NOTE: this is all so terrible
             *  finalResult.GeographicInfo = null;
             * }
             * else {
             *  if (finalResult.GeographicInfo == null) {
             *      finalResult.GeographicInfo = result.GeographicInfo;
             *  }
             *  else {
             *      finalResult.GeographicInfo.Datum.Spheroid = result.GeographicInfo.Datum.Spheroid;
             *  }
             * }*/
            return(finalResult);
        }
        private SpheroidProjectionBase CreateLambertAzimuthalEqualArea(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new LatitudeOfNaturalOriginParameterSelector();
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!originLatParam.IsSelected || !originLonParam.IsSelected || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!offsetXParam.IsSelected || !offsetYParam.IsSelected || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, out offset))
                offset = Vector2.Zero;

            var spherical = _coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("SPHERICAL");
            if (spherical)
                return new LambertAzimuthalEqualAreaSpherical(origin, offset, spheroid);

            if (Math.Abs(origin.Latitude - (Math.PI / 2.0)) < 0.00000001)
                return new LambertAzimuthalEqualAreaPolar(origin, offset, spheroid); // N
            if (Math.Abs(origin.Latitude - (Math.PI / -2.0)) < 0.00000001)
                return new LambertAzimuthalEqualAreaPolar(origin, offset, spheroid); // S

            return new LambertAzimuthalEqualAreaOblique(origin, offset, spheroid);
        }
        private ITransformation<GeographicCoordinate, Point2> CreateLambertConicConformal(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new KeywordNamedParameterSelector("LAT", "ORIGIN");
            var originLonParam = new KeywordNamedParameterSelector("LON", "ORIGIN", "CENTRAL", "MERIDIAN");
            var parallel1Param = new KeywordNamedParameterSelector("LAT", "1", "PARALLEL");
            var parallel2Param = new KeywordNamedParameterSelector("LAT", "2", "PARALLEL");
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            var scaleFactorParam = new ScaleFactorParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam, scaleFactorParam, parallel1Param, parallel2Param);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            double parallel1, parallel2;
            if (parallel1Param.IsSelected && parallel2Param.IsSelected && TryGetDouble(parallel1Param.Selection, OgcAngularUnit.DefaultRadians, out parallel1) && TryGetDouble(parallel2Param.Selection, OgcAngularUnit.DefaultRadians, out parallel2)) {
                if (_coordinateOperationNameComparer.Normalize(opData.OperationName).EndsWith("BELGIUM"))
                    return new LambertConicConformalBelgium(origin, parallel1, parallel2, offset, spheroid);

                return new LambertConicConformal2Sp(origin, parallel1, parallel2, offset, spheroid);
            }

            if (scaleFactorParam.IsSelected){
                double scaleFactor;
                if(TryGetDouble(scaleFactorParam.Selection, ScaleUnitUnity.Value, out scaleFactor))
                    return new LambertConicConformal1Sp(origin, scaleFactor, offset, spheroid);
            }

            return null;
        }
        private static SpheroidProjectionBase CreateLambertCylindricalEqualAreaSpherical(ProjectionCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var originLatParam = new MultiParameterSelector(
                new LatitudeOfNaturalOriginParameterSelector(),
                new StandardParallelParameterSelector());
            var originLonParam = new LongitudeOfNaturalOriginParameterSelector();
            var offsetXParam = new FalseEastingParameterSelector();
            var offsetYParam = new FalseNorthingParameterSelector();
            opData.ParameterLookup.Assign(originLatParam, originLonParam, offsetXParam, offsetYParam);

            var spheroid = opData.StepParams.ConvertRelatedOutputSpheroidUnit(opData.StepParams.RelatedOutputCrsUnit);
            if (null == spheroid)
                return null;

            GeographicCoordinate origin;
            if (!(originLatParam.IsSelected || originLonParam.IsSelected) || !TryCreateGeographicCoordinate(originLatParam.Selection, originLonParam.Selection, out origin))
                origin = GeographicCoordinate.Zero;

            Vector2 offset;
            if (!(offsetXParam.IsSelected || offsetYParam.IsSelected) || !TryCreateVector2(offsetXParam.Selection, offsetYParam.Selection, opData.StepParams.RelatedOutputCrsUnit, out offset))
                offset = Vector2.Zero;

            return new LambertCylindricalEqualAreaSpherical(origin, offset, spheroid);
        }