Initializes a new instance of the CoordinateSystem class from a definition.

Overload List

  NameDescription
CoordinateSystem(Int32)
Initializes a new instance of the CoordinateSystem class based on the specified unique identifier, sometimes referred to as the factory code or Well Known ID (WKID).
CoordinateSystem(String)
Initializes a new instance of the CoordinateSystem class from a definition stored in a .prj file.

Remarks

If you know the name and type of coordinate system you require and wish to hard code this choice, you may find the nested type initializers for CoordinateSystem..::.GeographicCoordinateSystems and CoordinateSystem..::.ProjectedCoordinateSystems useful.

Examples

The code below demonstrates alternative ways to initialize a CoordinateSystem variable, using the overloaded constructors and the nested type initializers on the CoordinateSystem class.
CopyC#
// If you know the coordinate system you require, you can hard-code this by using a nested type 
// initializer on the CoordinateSystem class; note these members are statics, and therefore should
// not use the 'new' keyword.
//esriSRProjCS_World_EckertIV 54012 Eckert IV. 
CoordinateSystem cs1 = CoordinateSystem.ProjectedCoordinateSystems.World.EckertIVWorld;

// If you know the identifier, you can create the same coordinate system by using the overloaded 
// constructor passing in the Id.
CoordinateSystem cs2 = new CoordinateSystem(54012);

// Alternatively, if you have a .prj file which defines a coordinate system, you can pass in the 
// filename to create the coordinate system.
string prjFilePath = @"C:\Some Data Path\EckertVI.prj";
CoordinateSystem cs3 = new CoordinateSystem(prjFilePath);
CopyVB.NET
' If you know the coordinate system you require, you can hard-code this by using a nested type 
' initializer on the CoordinateSystem class; note these members are statics, and therefore should
' not use the 'new' keyword.
Dim cs1 As CoordinateSystem = CoordinateSystem.ProjectedCoordinateSystems.World.EckertIVWorld

' If you know the identifier, you can create the same coordinate system by using the overloaded 
' constructor passing in the Id.
Dim cs2 As CoordinateSystem = New CoordinateSystem(54012)

' Alternatively, if you have a .prj file which defines a coordinate system, you can pass in the 
' filename to create the coordinate system.
Dim prjFilePath As String = "C:\Some Data Path\EckertVI.prj"
Dim cs3 As CoordinateSystem = New CoordinateSystem(prjFilePath)

See Also