SharpMap.CoordinateSystems.CoordinateSystemFactory.CreateFlattenedSphere C# (CSharp) Méthode

CreateFlattenedSphere() public méthode

Creates an Ellipsoid from an major radius, and inverse flattening.
public CreateFlattenedSphere ( string name, double semiMajorAxis, double inverseFlattening, ILinearUnit linearUnit ) : IEllipsoid
name string Name of ellipsoid
semiMajorAxis double Semi major-axis
inverseFlattening double Inverse flattening
linearUnit ILinearUnit Linear unit
Résultat IEllipsoid
        public IEllipsoid CreateFlattenedSphere(string name, double semiMajorAxis, double inverseFlattening, ILinearUnit linearUnit)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Invalid name");

            return new Ellipsoid(semiMajorAxis, -1, inverseFlattening, true, linearUnit, name, String.Empty, -1, String.Empty, String.Empty, String.Empty);
        }

Usage Example

	private void TestMercator_2SP()
	{
		CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();

		IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Krassowski 1940", 6378245.0, 298.3, LinearUnit.Metre);

		IHorizontalDatum datum = cFac.CreateHorizontalDatum("Krassowski 1940", DatumType.HD_Geocentric, ellipsoid, null);
		IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Krassowski 1940", AngularUnit.Degrees, datum, 
			PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
			new AxisInfo("Lat", AxisOrientationEnum.North));
        List<ProjectionParameter> parameters = new List<ProjectionParameter>();
		parameters.Add(new ProjectionParameter("latitude_of_origin", 42));
		parameters.Add(new ProjectionParameter("central_meridian", 51));
		parameters.Add(new ProjectionParameter("false_easting", 0));
		parameters.Add(new ProjectionParameter("false_northing", 0));
		IProjection projection = cFac.CreateProjection("Mercator_2SP", "Mercator_2SP", parameters);

		IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Pulkovo 1942 / Mercator Caspian Sea", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));

		ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);

		SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(53,53);
		SharpMap.Geometries.Point pUtm = new Point(trans.MathTransform.Transform(pGeo.ToDoubleArray()));
        SharpMap.Geometries.Point pGeo2 = new Point(trans.MathTransform.Inverse().Transform(pUtm.ToDoubleArray()));

		result.Text += PrintResultTable(gcs, coordsys, pGeo, pUtm, new Point(165704.29, 5171848.07), pGeo2, "Mercator_2SP test");
	}
All Usage Examples Of SharpMap.CoordinateSystems.CoordinateSystemFactory::CreateFlattenedSphere