This document is archived and information here might be outdated.  Recommended version.


Creating a predefined geographic coordinate system (ArcObjects .NET 10.4 SDK)

Creating a predefined geographic coordinate system


About creating a predefined geographic coordinate system

The ISpatialReferenceFactory interface provides access for creating a geographic coordinate system (GCS) in ArcGIS. You can return a single GCS with ISpatialReferenceFactory.CreateGeographicCoordinateSystem. Lists of the supported GCS are available in the esriSRGeoCSType, esriSRGeoCS2Type, and esriSRGeoCS3Type enumerations.
See the following code example:
[C#]
private void CreateGeographicCoordinateSystem()
{
    // Set up the SpatialReferenceEnvironment.
    // SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.

    Type t=Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
    System.Object obj=Activator.CreateInstance(t);
    ISpatialReferenceFactory srFact=obj as ISpatialReferenceFactory;

    // Use the enumeration to create an instance of the predefined object.

    IGeographicCoordinateSystem geographicCS =
        srFact.CreateGeographicCoordinateSystem((int)
        esriSRGeoCSType.esriSRGeoCS_NAD1983);
}
[VB.NET]
Private Sub CreateGeographicReferenceSystem()
    ' Set up the SpatialReferenceEnvironment.
    ' SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.
    
    Dim t As Type=Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment")
    Dim obj As System.Object=Activator.CreateInstance(t)
    Dim srFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory=obj
    
    ' Use the enumeration to create an instance of the predefined object.
    
    Dim geographicCS As IGeographicCoordinateSystem=srFact.CreateGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_NAD1983)
End Sub


See Also:

Creating a custom geographic coordinate system




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Basic ArcGIS for Desktop Basic