Interface ISpatialReferenceFactory2
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
Methods
CreateDatum(int)
IDatum CreateDatum(int datumType)
Parameters
datumTypeint
Returns
CreateESRISpatialReference(string, out ISpatialReference, out int)
void CreateESRISpatialReference(string spatRefInfo, out ISpatialReference SpatialReference, out int cBytesRead)
Parameters
spatRefInfostringSpatialReferenceISpatialReferencecBytesReadint
CreateESRISpatialReferenceFromPRJ(string)
ISpatialReference CreateESRISpatialReferenceFromPRJ(string prj)
Parameters
prjstring
Returns
CreateESRISpatialReferenceFromPRJFile(string)
ISpatialReference CreateESRISpatialReferenceFromPRJFile(string prjFile)
Parameters
prjFilestring
Returns
CreateGeoTransformation(int)
ITransformation CreateGeoTransformation(int gTransformationType)
Parameters
gTransformationTypeint
Returns
CreateGeographicCoordinateSystem(int)
IGeographicCoordinateSystem CreateGeographicCoordinateSystem(int gcsType)
Parameters
gcsTypeint
Returns
CreateParameter(int)
IParameter CreateParameter(int parameterType)
Parameters
parameterTypeint
Returns
CreatePredefinedAngularUnits()
ISet CreatePredefinedAngularUnits()
Returns
CreatePredefinedDatums()
ISet CreatePredefinedDatums()
Returns
CreatePredefinedGeographicTransformations()
Creates a list of predefined geographic transformations.
ISet CreatePredefinedGeographicTransformations()
Returns
CreatePredefinedLinearUnits()
ISet CreatePredefinedLinearUnits()
Returns
CreatePredefinedPrimeMeridians()
ISet CreatePredefinedPrimeMeridians()
Returns
CreatePredefinedProjections()
ISet CreatePredefinedProjections()
Returns
CreatePredefinedSpheroids()
ISet CreatePredefinedSpheroids()
Returns
CreatePrimeMeridian(int)
IPrimeMeridian CreatePrimeMeridian(int primeMeridianType)
Parameters
primeMeridianTypeint
Returns
CreateProjectedCoordinateSystem(int)
IProjectedCoordinateSystem CreateProjectedCoordinateSystem(int pcsType)
Parameters
pcsTypeint
Returns
CreateProjection(int)
IProjection CreateProjection(int projectionType)
Parameters
projectionTypeint
Returns
CreateSpatialReference(int)
Creates a predefined spatial reference from an srID.
ISpatialReference CreateSpatialReference(int srID)
Parameters
srIDint
Returns
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.
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
spheroidTypeint
Returns
CreateUnit(int)
IUnit CreateUnit(int unitType)
Parameters
unitTypeint
Returns
ExportESRISpatialReferenceToPRJFile(string, ISpatialReference)
void ExportESRISpatialReferenceToPRJFile(string prjFile, ISpatialReference SpatialReference)
Parameters
prjFilestringSpatialReferenceISpatialReference
GetPredefinedGeographicTransformations()
Returns a list of predefined geographic transformations.
ISet GetPredefinedGeographicTransformations()