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

CreateProjectedCoordinateSystem() public méthode

Creates a ProjectedCoordinateSystem using a projection object.
public CreateProjectedCoordinateSystem ( string name, IGeographicCoordinateSystem gcs, IProjection projection, ILinearUnit linearUnit, AxisInfo axis0, AxisInfo axis1 ) : IProjectedCoordinateSystem
name string Name of projected coordinate system
gcs IGeographicCoordinateSystem Geographic coordinate system
projection IProjection Projection
linearUnit ILinearUnit Linear unit
axis0 AxisInfo Primary axis
axis1 AxisInfo Secondary axis
Résultat IProjectedCoordinateSystem
        public IProjectedCoordinateSystem CreateProjectedCoordinateSystem(string name, IGeographicCoordinateSystem gcs, IProjection projection, ILinearUnit linearUnit, AxisInfo axis0, AxisInfo axis1)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Invalid name");
            if (gcs == null)
                throw new ArgumentException("Geographic coordinate system was null");
            if (projection == null)
                throw new ArgumentException("Projection was null");
            if (linearUnit == null)
                throw new ArgumentException("Linear unit was null");
            List<AxisInfo> info = new List<AxisInfo>(2);
            info.Add(axis0);
            info.Add(axis1);
            return new ProjectedCoordinateSystem(null, gcs, linearUnit, projection, info, 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::CreateProjectedCoordinateSystem