ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / ProjectEx Method
The geometry to be projected. The geometry spatial reference is ignored.
The projection transformation to use. The geometry is projected from the projTransformation.InputSpatialReference to the projTransformation.OutputSpatialReference
Example Version

ProjectEx Method (GeometryEngine)
Projects the given geometry to a new spatial reference.
Syntax

Parameters

geometry
The geometry to be projected. The geometry spatial reference is ignored.
projTransformation
The projection transformation to use. The geometry is projected from the projTransformation.InputSpatialReference to the projTransformation.OutputSpatialReference

Return Value

The projected geometry. If the input geometry is empty, then an empty geometry with the output spatial reference is returned.
Exceptions
ExceptionDescription
Geometry is null.
The method is not implemented for GeometryBag.
Projection transformation is null.
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 or higher.
See Also