SharpMap.CoordinateSystems.CoordinateSystemFactory.CreateGeographicCoordinateSystem C# (CSharp) 메소드

CreateGeographicCoordinateSystem() 공개 메소드

Creates a GeographicCoordinateSystem, which could be Lat/Lon or Lon/Lat.
public CreateGeographicCoordinateSystem ( string name, IAngularUnit angularUnit, IHorizontalDatum datum, IPrimeMeridian primeMeridian, AxisInfo axis0, AxisInfo axis1 ) : IGeographicCoordinateSystem
name string Name of geographical coordinate system
angularUnit IAngularUnit Angular units
datum IHorizontalDatum Horizontal datum
primeMeridian IPrimeMeridian Prime meridian
axis0 AxisInfo First axis
axis1 AxisInfo Second axis
리턴 IGeographicCoordinateSystem
        public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(string name, IAngularUnit angularUnit, IHorizontalDatum datum, IPrimeMeridian primeMeridian, AxisInfo axis0, AxisInfo axis1)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Invalid name");
            List<AxisInfo> info = new List<AxisInfo>(2);
            info.Add(axis0);
            info.Add(axis1);
            return new GeographicCoordinateSystem(angularUnit, datum, primeMeridian,info, name, String.Empty, -1, String.Empty, String.Empty, String.Empty);
        }

Usage Example

		public void TestMercator_1SP_Projection()
		{
			CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();

			IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre);

			IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null);
			IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum,
				PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
				new AxisInfo("Lat", AxisOrientationEnum.North));
			System.Collections.Generic.List<ProjectionParameter> parameters = new System.Collections.Generic.List<ProjectionParameter>(5);
			parameters.Add(new ProjectionParameter("latitude_of_origin", 0));
			parameters.Add(new ProjectionParameter("central_meridian", 110));
			parameters.Add(new ProjectionParameter("scale_factor", 0.997));
			parameters.Add(new ProjectionParameter("false_easting", 3900000));
			parameters.Add(new ProjectionParameter("false_northing", 900000));
			IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters);

			IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));

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

			double[] pGeo = new double[] { 120, -3 };
			double[] pUtm = trans.MathTransform.Transform(pGeo);
			double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);

			double[] expected = new double[] { 5009726.58, 569150.82 };
			Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
			Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
		}
All Usage Examples Of SharpMap.CoordinateSystems.CoordinateSystemFactory::CreateGeographicCoordinateSystem