Provides access to members that create different kinds of spatial reference components.
Description
ISpatialReferenceFactory2 extends the ISpatialReferenceFactory interface and provides methods for accessing a variety of predefined geographic (datum) transformations and creating any kind of spatial reference (PCS or GCS) from its factory code.
Members
Name | Description | |
---|---|---|
CreateDatum | Creates a predefined datum. | |
CreateESRISpatialReference | Creates a spatial reference system and defines it from the specified ESRISpatialReference buffer. | |
CreateESRISpatialReferenceFromPRJ | Creates a spatial reference from a PRJ string. | |
CreateESRISpatialReferenceFromPRJFile | Creates a spatial reference from a PRJ file. | |
CreateGeographicCoordinateSystem | Creates a predefined geographic coordinate system. | |
CreateGeoTransformation | Creates a predefined transformation between geographic coordinate systems. | |
CreateParameter | Creates a predefined parameter. | |
CreatePredefinedAngularUnits | Creates a list of predefined angular units. | |
CreatePredefinedDatums | Creates a list of a list of predefined datums. | |
CreatePredefinedGeographicTransformations | Creates a list of predefined geographic transformations. | |
CreatePredefinedLinearUnits | Creates a list of predefined linear units. | |
CreatePredefinedPrimeMeridians | Creates a list of predefined prime meridians. | |
CreatePredefinedProjections | Creates a list of predefined projections. | |
CreatePredefinedSpheroids | Creates a list of predefined spheroids. | |
CreatePrimeMeridian | Creates a predefined prime meridian. | |
CreateProjectedCoordinateSystem | Creates a predefined projected coordinate system. | |
CreateProjection | Creates a predefined projection. | |
CreateSpatialReference | Creates a predefined spatial reference from an srID. | |
CreateSpheroid | Creates a predefined spheroid. | |
CreateUnit | Creates a predefined unit of measure. | |
ExportESRISpatialReferenceToPRJFile | Exports a spatial reference to a PRJ file. | |
GeoTransformationDefaults | Returns a list of default geographic transformations. | |
GetPredefinedGeographicTransformations | Returns a list of predefined geographic transformations. |
ISpatialReferenceFactory2.CreatePredefinedGeographicTransformations Method
Creates a list of predefined geographic transformations.
Public Function CreatePredefinedGeographicTransformations ( _
) As ISet
public ISet CreatePredefinedGeographicTransformations (
);
Description
Returns a list of all predefined geographic (datum) transformations. The list has two columns: the factory code and the name.
ISpatialReferenceFactory2.CreateSpatialReference Method
Creates a predefined spatial reference from an srID.
Public Function CreateSpatialReference ( _
ByVal srID As Integer _
) As ISpatialReference
public ISpatialReference CreateSpatialReference (
int srID
);
Description
Use a srID from the esriSRProjCSType or esriSRGeoCSType enumerations to create a particular predefined spatial reference.
Errors Returned
E_INVALIDARG is returned if the srID is not a valid geographic or projected coordinate system.
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");
}
}
}
ISpatialReferenceFactory2.GeoTransformationDefaults Property
Returns a list of default geographic transformations.
Public ReadOnly Property GeoTransformationDefaults As IGeoTransformationOperationSet
public IGeoTransformationOperationSet GeoTransformationDefaults {get;}
ISpatialReferenceFactory2.GetPredefinedGeographicTransformations Method
Returns a list of predefined geographic transformations.
Public Function GetPredefinedGeographicTransformations ( _
) As ISet
public ISet GetPredefinedGeographicTransformations (
);
Inherited Interfaces
Interfaces | Description |
---|---|
ISpatialReferenceFactory | Provides access to members that create different kinds of spatial reference components. |
Classes that implement ISpatialReferenceFactory2
Classes | Description |
---|---|
SpatialReferenceEnvironment | Creates various spatial reference objects. |
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.