How to create a predefined geotransformation


Creating a predefined geotransformation

To access the hundreds of predefined geographic transformations, ISpatialReferenceFactory has the CreateGeoTransformation method. The predefined geographic transformations are listed in the esriSRGeoTransformationType, esriSRGeoTransformation2Type, and esriSRGeoTransformation3Type enumerations.
The following code illustrates creating a geotransformation using the spatial reference factory. The GetSpatialReferences method is then used to return the source and target spatial references of the geotransformation.
[Java]
static void transform()throws Exception{
    ISpatialReferenceFactory2 spatialReferenceFactory2 = new
        SpatialReferenceEnvironment();

    //Mean for Great Britain.
    IGeoTransformation geoTransformation = (IGeoTransformation)
        spatialReferenceFactory2.createGeoTransformation((int)
        esriSRGeoTransformationType.esriSRGeoTransformation_OSGB1936_To_WGS1984_1);

    ISpatialReference[] fromSpatialReference = new ISpatialReference[1];
    ISpatialReference[] toSpatialReference = new ISpatialReference[1];
    geoTransformation.getSpatialReferences(fromSpatialReference, toSpatialReference);

    System.out.println(geoTransformation.getName());
    System.out.println(fromSpatialReference[0].getName() + ", " +
        toSpatialReference[0].getName());
}


See Also:

Understanding geotransformations




Additional Requirements
  • This article assumes your project includes references to the ESRI Geometry assembly.

Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime