Interface ISpatialReferenceFactory2

Namespace
ESRI.ArcGIS.Geometry
Assembly
ESRI.Server.Geometry.dll

Provides access to members that create different kinds of spatial reference components.

[Guid("1F050200-DA7F-11D3-9F60-00C04F6BDD7F")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISpatialReferenceFactory2 : ISpatialReferenceFactory

Remarks

The CreatePredefinedGeographicTransformations and the GetPredefinedGeographicTransformations methods both return an ISet of all the possible geotransformations that ArcObjects can create. The SpatialReferenceEnvironment maintains ownership of the set returned by GetPredefinedGeographicTransformations. Neither this set nor its elements should be modified.  The Set and transformation elements returned by CreatePredefinedGeographicTransformations can be modified.

Properties

GeoTransformationDefaults

Returns a list of default geographic transformations.

IGeoTransformationOperationSet GeoTransformationDefaults { get; }

Property Value

IGeoTransformationOperationSet

Methods

CreateDatum(int)

IDatum CreateDatum(int datumType)

Parameters

datumType int

Returns

IDatum

CreateESRISpatialReference(string, out ISpatialReference, out int)

void CreateESRISpatialReference(string spatRefInfo, out ISpatialReference SpatialReference, out int cBytesRead)

Parameters

spatRefInfo string
SpatialReference ISpatialReference
cBytesRead int

CreateESRISpatialReferenceFromPRJ(string)

ISpatialReference CreateESRISpatialReferenceFromPRJ(string prj)

Parameters

prj string

Returns

ISpatialReference

CreateESRISpatialReferenceFromPRJFile(string)

ISpatialReference CreateESRISpatialReferenceFromPRJFile(string prjFile)

Parameters

prjFile string

Returns

ISpatialReference

CreateGeoTransformation(int)

ITransformation CreateGeoTransformation(int gTransformationType)

Parameters

gTransformationType int

Returns

ITransformation

CreateGeographicCoordinateSystem(int)

IGeographicCoordinateSystem CreateGeographicCoordinateSystem(int gcsType)

Parameters

gcsType int

Returns

IGeographicCoordinateSystem

CreateParameter(int)

IParameter CreateParameter(int parameterType)

Parameters

parameterType int

Returns

IParameter

CreatePredefinedAngularUnits()

ISet CreatePredefinedAngularUnits()

Returns

ISet

CreatePredefinedDatums()

ISet CreatePredefinedDatums()

Returns

ISet

CreatePredefinedGeographicTransformations()

Creates a list of predefined geographic transformations.

ISet CreatePredefinedGeographicTransformations()

Returns

ISet

CreatePredefinedLinearUnits()

ISet CreatePredefinedLinearUnits()

Returns

ISet

CreatePredefinedPrimeMeridians()

ISet CreatePredefinedPrimeMeridians()

Returns

ISet

CreatePredefinedProjections()

ISet CreatePredefinedProjections()

Returns

ISet

CreatePredefinedSpheroids()

ISet CreatePredefinedSpheroids()

Returns

ISet

CreatePrimeMeridian(int)

IPrimeMeridian CreatePrimeMeridian(int primeMeridianType)

Parameters

primeMeridianType int

Returns

IPrimeMeridian

CreateProjectedCoordinateSystem(int)

IProjectedCoordinateSystem CreateProjectedCoordinateSystem(int pcsType)

Parameters

pcsType int

Returns

IProjectedCoordinateSystem

CreateProjection(int)

IProjection CreateProjection(int projectionType)

Parameters

projectionType int

Returns

IProjection

CreateSpatialReference(int)

Creates a predefined spatial reference from an srID.

ISpatialReference CreateSpatialReference(int srID)

Parameters

srID int

Returns

ISpatialReference

Remarks

The CreateSpatialReference method creates a valid SpatialReference, either a projected or geographic coordinate system, depending on the supplied FactoryCode (here called an srID). The method returns an ISpatialReference. The example code illustrates how to test for what type of SpatialReference has been created. This method will raise an error (E_INVALIDARG) if the FactoryCode number supplied is not valid.

[C#]

    private void CreateSpatialReference(int spatialReferenceID)
    {
        // use activator class with SpatialReferenceEnvironment singleton
        Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
        System.Object obj = Activator.CreateInstance(factoryType);
        ISpatialReferenceFactory2 spatialReferenceFactory = obj as ISpatialReferenceFactory2;




        //Some examples of spatialReferenceIDs are:
        //esriSRProjCS_ColombiaBogota = 21892
        //esriSRGeoCS_Australian = 4003
        ISpatialReference spatialReference = spatialReferenceFactory.CreateSpatialReference(spatialReferenceID);
        if (spatialReference is IProjectedCoordinateSystem)
        {
            System.Windows.Forms.MessageBox.Show("You have a Projected Coordinate System");
        }
        else
        {
            if (spatialReference is IGeographicCoordinateSystem)
            {
                System.Windows.Forms.MessageBox.Show("You have a Geographic Coordinate System");
            }
        }
    }














CreateSpheroid(int)

ISpheroid CreateSpheroid(int spheroidType)

Parameters

spheroidType int

Returns

ISpheroid

CreateUnit(int)

IUnit CreateUnit(int unitType)

Parameters

unitType int

Returns

IUnit

ExportESRISpatialReferenceToPRJFile(string, ISpatialReference)

void ExportESRISpatialReferenceToPRJFile(string prjFile, ISpatialReference SpatialReference)

Parameters

prjFile string
SpatialReference ISpatialReference

GetPredefinedGeographicTransformations()

Returns a list of predefined geographic transformations.

ISet GetPredefinedGeographicTransformations()

Returns

ISet