This document is archived and information here might be outdated.  Recommended version.

IGeometry2.ProjectEx Method (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometry2 Interface > IGeometry2.ProjectEx Method
ArcGIS Developer Help

IGeometry2.ProjectEx Method

Projects a geometry, optionally applies a GeoTransformation, and optionally densifies the geometry.

[Visual Basic .NET]
Public Sub ProjectEx ( _
    ByVal newReferenceSystem As ISpatialReference, _
    ByVal Direction As esriTransformDirection, _
    ByVal GeoTransformation As IGeoTransformation, _
    ByVal bAngularDensify As Boolean, _
    ByVal maxSegmentLength As Double, _
    ByVal maxDeviation As Double _
public void ProjectEx (
    ISpatialReference newReferenceSystem,
    esriTransformDirection Direction,
    IGeoTransformation GeoTransformation,
    bool bAngularDensify,
    double maxSegmentLength,
    double maxDeviation
HRESULT ProjectEx(
  ISpatialReference* newReferenceSystem,
  esriTransformDirection Direction,
  IGeoTransformation* GeoTransformation,
  VARIANT_BOOL bAngularDensify,
  double maxSegmentLength,
  double maxDeviation

newReferenceSystem is a parameter of type ISpatialReference* Direction
Direction is a parameter of type esriTransformDirection GeoTransformation
GeoTransformation is a parameter of type IGeoTransformation* bAngularDensify
bAngularDensify is a parameter of type bool maxSegmentLength
maxSegmentLength is a parameter of type double maxDeviation
maxDeviation is a parameter of type double

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned

Run-time Error: 430 Class does not support Automation or does not support expected interface

This error will be produced when IGeometry2::ProjectEx is used on a GeometryBag which contains segments: BezierCurve, CircularArc, EllipticArc, Line. Segments do not implement IGeometry2. To avoid this restriction convert the segment into a Polyline before adding it to the GeometryBag.


By default, ProjectEx will not densify geometries as they are projected. This can lead to the output geometries not reflecting the 'true' shape in the new coordinate system. A straight line in one coordinate system is not necessarily a straight line in a different coordinate system. Set the bAngularDensify parameter if you want to densify the geometries while they are projected.


    //This example demonstrates how to use IGeometry2::ProjectEx
    public void ProjectExExample()
        //Create source spatial reference
        ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
        ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
        spatialReference.SetFalseOriginAndUnits(-80.0000000232831, 39.9999999767169, 42949672.9);
        //Create envelope and define its spatial reference
        IEnvelope envelope = new EnvelopeClass();
        envelope.PutCoords(-68.6076204314651, 49.6186709634653, -68.5531907607304, 49.6530789785679);
        envelope.SpatialReference = spatialReference;
        //Destination spatial reference
        IProjectedCoordinateSystem projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1927UTM_19N);
        //Define the XYDomain equivalent to SetFalseOriginAndUnits
        projectedCoordinateSystem.SetDomain(500000, 600000, 5300000, 5600000);
        //Create a Geotransformation (Datum transformation)
        IGeoTransformation geoTransformation = spatialReferenceFactory.CreateGeoTransformation((int)esriSRGeoTransformationType.esriSRGeoTransformation_NAD1927_To_WGS1984_12) as IGeoTransformation;

        String report = "Print envelope coordinates before projection:\n" +
        envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax + "\n\n\n";

        //Project envelope
        IGeometry2 geometry = envelope as IGeometry2;
        geometry.ProjectEx(projectedCoordinateSystem as ISpatialReference, esriTransformDirection.esriTransformReverse, geoTransformation, false, 0, 0);

        report = report + "Print envelope coordinates after projection:\n" +
        envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax;

See Also

IGeometry2 Interface