public static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid) { ParameterList parameterList = new ParameterList(); for(int i=0; i< projection.NumParameters; i++) { ProjectionParameter param = projection.GetParameter(i); parameterList.Add(param.Name,param.Value); } parameterList.Add("semi_major",ellipsoid.SemiMajorAxis); parameterList.Add("semi_minor",ellipsoid.SemiMinorAxis); IMathTransform transform = null; switch(projection.Name.ToLower()) { case "mercator": //1SP transform = new MercatorProjection(parameterList); break; case "transverse_mercator": transform = new TransverseMercatorProjection(parameterList); break; case "albers": transform = new AlbersProjection(parameterList); break; case "lambert": transform = new LambertConformalConic2SPProjection(parameterList); break; default: throw new NotSupportedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Projection {0} is not supported.",projection.AuthorityCode)); } return transform; }
/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform GetInverse() { if (_inverse == null) { _inverse = new LambertConformalConic2SPProjection(this._parameters, !_isInverse); } return(_inverse); }
public static IMathTransform CreateCoordinateOperation(IProjection projection, IEllipsoid ellipsoid) { ParameterList parameterList = new ParameterList(); for (int i = 0; i < projection.NumParameters; i++) { ProjectionParameter param = projection.GetParameter(i); parameterList.Add(param.Name, param.Value); } parameterList.Add("semi_major", ellipsoid.SemiMajorAxis); parameterList.Add("semi_minor", ellipsoid.SemiMinorAxis); IMathTransform transform = null; switch (projection.Name.ToLower()) { case "mercator": //1SP transform = new MercatorProjection(parameterList); break; case "transverse_mercator": transform = new TransverseMercatorProjection(parameterList); break; case "albers": transform = new AlbersProjection(parameterList); break; case "lambert": transform = new LambertConformalConic2SPProjection(parameterList); break; default: throw new NotSupportedException(String.Format("Projection {0} is not supported.", projection.AuthorityCode)); } return(transform); }
/// <summary> /// Returns the inverse of this projection. /// </summary> /// <returns>IMathTransform that is the reverse of the current projection.</returns> public override IMathTransform GetInverse() { if (_inverse==null) { _inverse = new LambertConformalConic2SPProjection(this._parameters, ! _isInverse); } return _inverse; }
/// <summary> /// /// </summary> /// <param name="name">Name to give new object.</param> /// <param name="wktProjectionClass">Classification string for projection (e.g. "Transverse_Mercator").</param> /// <param name="parameters">Parameters to use for projection. A default set of parameters can /// be constructed using classification and initialized /// using a chain of SetParameter(...) calls.</param> /// <returns>A projection.</returns> public IProjection CreateProjection(string name, string wktProjectionClass, ProjectionParameter[] parameters) { if (name==null) { throw new ArgumentNullException("name"); } ParameterList parameterList = new ParameterList(); for(int i=0; i< parameters.Length; i++) { ProjectionParameter param = parameters[i]; parameterList.Add(param.Name,param.Value); } IProjection projection= null; switch (wktProjectionClass.ToLower()) { case "transverse_mercator": projection = new TransverseMercatorProjection(parameterList); break; case "mercator": projection = new MercatorProjection(parameterList); break; case "lambert_conformal_conic_2sp": projection = new LambertConformalConic2SPProjection(parameterList); break; case "albers": projection = new AlbersProjection(parameterList); break; default: throw new NotImplementedException(String.Format("The {0} projection is not supported",wktProjectionClass)); } return projection; }