/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform Inverse() { if (_inverse == null) { _inverse = new AlbersProjection(this._Parameters, !_isInverse); } return(_inverse); }
/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform Inverse() { if (_inverse == null) { _inverse = new AlbersProjection(_Parameters.ToProjectionParameter(), this); } return(_inverse); }
/// <summary> /// Creates an instance of an Albers projection object. /// </summary> /// <remarks> /// <para>The parameters this projection expects are listed below.</para> /// <list type="table"> /// <listheader><term>Items</term><description>Descriptions</description></listheader> /// <item><term>latitude_of_center</term><description>The latitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item> /// <item><term>longitude_of_center</term><description>The longitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item> /// <item><term>standard_parallel_1</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is nearest the pole. Scale is true along this parallel.</description></item> /// <item><term>standard_parallel_2</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is furthest from the pole. Scale is true along this parallel.</description></item> /// <item><term>false_easting</term><description>The easting value assigned to the false origin.</description></item> /// <item><term>false_northing</term><description>The northing value assigned to the false origin.</description></item> /// </list> /// </remarks> /// <param name="parameters">List of parameters to initialize the projection.</param> /// <param name="inverse">Indicates whether the projection forward (meters to degrees or degrees to meters).</param> protected AlbersProjection(IEnumerable <ProjectionParameter> parameters, AlbersProjection inverse) : base(parameters, inverse) { Name = "Albers_Conic_Equal_Area"; var lat0 = lat_origin; var lat1 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_1")); var lat2 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_2")); if (Math.Abs(lat1 + lat2) < double.Epsilon) { throw new ArgumentException("Equal latitudes for standard parallels on opposite sides of Equator."); } var alpha1 = alpha(lat1); var alpha2 = alpha(lat2); var m1 = Math.Cos(lat1) / Math.Sqrt(1 - _es * Math.Pow(Math.Sin(lat1), 2)); var m2 = Math.Cos(lat2) / Math.Sqrt(1 - _es * Math.Pow(Math.Sin(lat2), 2)); _n = (Math.Pow(m1, 2) - Math.Pow(m2, 2)) / (alpha2 - alpha1); _c = Math.Pow(m1, 2) + (_n * alpha1); _ro0 = Ro(alpha(lat0)); /* * double sin_p0 = Math.Sin(lat0); * double cos_p0 = Math.Cos(lat0); * double q0 = qsfnz(e, sin_p0, cos_p0); * * double sin_p1 = Math.Sin(lat1); * double cos_p1 = Math.Cos(lat1); * double m1 = msfnz(e,sin_p1,cos_p1); * double q1 = qsfnz(e,sin_p1,cos_p1); * * * double sin_p2 = Math.Sin(lat2); * double cos_p2 = Math.Cos(lat2); * double m2 = msfnz(e,sin_p2,cos_p2); * double q2 = qsfnz(e,sin_p2,cos_p2); * * if (Math.Abs(lat1 - lat2) > EPSLN) * ns0 = (m1 * m1 - m2 * m2)/ (q2 - q1); * else * ns0 = sin_p1; * C = m1 * m1 + ns0 * q1; * rh = this._semiMajor * Math.Sqrt(C - ns0 * q0)/ns0; */ }
private static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid, ILinearUnit unit) { List<ProjectionParameter> parameterList = new List<ProjectionParameter>(projection.NumParameters); for (int i = 0; i < projection.NumParameters; i++) parameterList.Add(projection.GetParameter(i)); parameterList.Add(new ProjectionParameter("semi_major", ellipsoid.SemiMajorAxis)); parameterList.Add(new ProjectionParameter("semi_minor", ellipsoid.SemiMinorAxis)); parameterList.Add(new ProjectionParameter("unit", unit.MetersPerUnit)); IMathTransform transform = null; switch (projection.ClassName.ToLower(CultureInfo.InvariantCulture).Replace(' ', '_')) { case "mercator": case "mercator_1sp": case "mercator_2sp": //1SP transform = new Mercator(parameterList); break; case "transverse_mercator": transform = new TransverseMercator(parameterList); break; case "albers": case "albers_conic_equal_area": transform = new AlbersProjection(parameterList); break; case "krovak": transform = new KrovakProjection(parameterList); break; case "lambert_conformal_conic": case "lambert_conformal_conic_2sp": case "lambert_conic_conformal_(2sp)": transform = new LambertConformalConic2SP(parameterList); break; default: throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.ClassName)); } return transform; }
/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform Inverse() { if (_inverse == null) _inverse = new AlbersProjection(_Parameters.ToProjectionParameter(), this); return _inverse; }
/// <summary> /// Creates an instance of an Albers projection object. /// </summary> /// <remarks> /// <para>The parameters this projection expects are listed below.</para> /// <list type="table"> /// <listheader><term>Items</term><description>Descriptions</description></listheader> /// <item><term>latitude_of_center</term><description>The latitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item> /// <item><term>longitude_of_center</term><description>The longitude of the point which is not the natural origin and at which grid coordinate values false easting and false northing are defined.</description></item> /// <item><term>standard_parallel_1</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is nearest the pole. Scale is true along this parallel.</description></item> /// <item><term>standard_parallel_2</term><description>For a conic projection with two standard parallels, this is the latitude of intersection of the cone with the ellipsoid that is furthest from the pole. Scale is true along this parallel.</description></item> /// <item><term>false_easting</term><description>The easting value assigned to the false origin.</description></item> /// <item><term>false_northing</term><description>The northing value assigned to the false origin.</description></item> /// </list> /// </remarks> /// <param name="parameters">List of parameters to initialize the projection.</param> /// <param name="inverse">Indicates whether the projection forward (meters to degrees or degrees to meters).</param> protected AlbersProjection(IEnumerable<ProjectionParameter> parameters, AlbersProjection inverse) : base(parameters, inverse) { Name = "Albers_Conic_Equal_Area"; var lat0 = lat_origin; var lat1 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_1")); var lat2 = Degrees2Radians(_Parameters.GetParameterValue("standard_parallel_2")); if (Math.Abs(lat1 + lat2) < double.Epsilon) throw new ArgumentException("Equal latitudes for standard parallels on opposite sides of Equator."); var alpha1 = alpha(lat1); var alpha2 = alpha(lat2); var m1 = Math.Cos(lat1) / Math.Sqrt(1 - _es * Math.Pow(Math.Sin(lat1), 2)); var m2 = Math.Cos(lat2) / Math.Sqrt(1 - _es * Math.Pow(Math.Sin(lat2), 2)); _n = (Math.Pow(m1, 2) - Math.Pow(m2, 2)) / (alpha2 - alpha1); _c = Math.Pow(m1, 2) + (_n * alpha1); _ro0 = Ro(alpha(lat0)); /* double sin_p0 = Math.Sin(lat0); double cos_p0 = Math.Cos(lat0); double q0 = qsfnz(e, sin_p0, cos_p0); double sin_p1 = Math.Sin(lat1); double cos_p1 = Math.Cos(lat1); double m1 = msfnz(e,sin_p1,cos_p1); double q1 = qsfnz(e,sin_p1,cos_p1); double sin_p2 = Math.Sin(lat2); double cos_p2 = Math.Cos(lat2); double m2 = msfnz(e,sin_p2,cos_p2); double q2 = qsfnz(e,sin_p2,cos_p2); if (Math.Abs(lat1 - lat2) > EPSLN) ns0 = (m1 * m1 - m2 * m2)/ (q2 - q1); else ns0 = sin_p1; C = m1 * m1 + ns0 * q1; rh = this._semiMajor * Math.Sqrt(C - ns0 * q0)/ns0; */ }
/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform Inverse() { if (_inverse == null) _inverse = new AlbersProjection(this._Parameters, !_isInverse); return _inverse; }