ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Geometry Namespace / ProjectionTransformation Class / Create Method
The spatial reference to project from. Cannot be unknown coordinate system.
The spatial reference to project to. Cannot be unknown coordinate system.
(Optional) The extent of the data that is being projected. Default is null. A null value or an empty envelope means the extent is the entire world.
Example

In This Topic
    Create Method (ProjectionTransformation)
    In This Topic
    Creates a projection transformation from two spatial references and an extent of interest. Automatically selects a geographic transformation for the projection.
    Syntax

    Parameters

    inputSR
    The spatial reference to project from. Cannot be unknown coordinate system.
    outputSR
    The spatial reference to project to. Cannot be unknown coordinate system.
    extentOfInterest
    (Optional) The extent of the data that is being projected. Default is null. A null value or an empty envelope means the extent is the entire world.

    Return Value

    Example
    Create Projection Transformation
    // methods need to be on the MCT
    ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    {
      SpatialReference sr4267 = SpatialReferenceBuilder.CreateSpatialReference(4267);
      SpatialReference sr4326 = SpatialReferences.WGS84;
      SpatialReference sr3857 = SpatialReferences.WebMercator;
    
      // Create transformation from  4267 -> 3857
      ProjectionTransformation projTransFromSRs = 
           ArcGIS.Core.Geometry.ProjectionTransformation.Create(sr4267, sr3857);
    
      // create an envelope
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(
                 new Coordinate2D(2, 2), new Coordinate2D(3, 3), sr4267);
    
      // Project with one geo transform 4267 -> 3857
      Envelope projectedEnvEx = GeometryEngine.Instance.ProjectEx(
                                     env, projTransFromSRs) as Envelope;
    
      // Create inverse transformation, 3857 -> 4267
      ProjectionTransformation projTransFromSRsInverse = 
          ArcGIS.Core.Geometry.ProjectionTransformation.Create(sr3857, sr4267);
      // Project the projected envelope back using the inverse transformation
      Envelope projectedEnvBack = 
             GeometryEngine.Instance.ProjectEx(
               projectedEnvEx, projTransFromSRsInverse) as Envelope;
    
      bool isEqual = env.IsEqual(projectedEnvBack);
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also