ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / Transform3D Method
The set of coordinates to be transformed.
The projection transformation specifying the input and output spatial references and possibly the geographic transformations to use for the transformation.
The set of transformed coordinates. If it is null or the length is less than the length of inCoordinates, then a new array will be allocated.
(Optional) The boolean value specifying whether to remove clipped coordinates or not. If true, the coordinates outside of the horizon will be removed from the output array, and the number of initialized elements in the output array is the number of coordinates transformed which may be less than the number of elements in inCoordinates. If false, all coordinates are preserved, the clipped out coordinates are set to NaN in the output array, and the number of elements in the output array is equal to the number of elements in inCoordinates. The default value is true.
Example

In This Topic
    Transform3D Method (IGeometryEngine)
    In This Topic
    Transforms an enumeration of 3D coordinates. Returns an enumeration of transformed 3D coordinates.
    Syntax

    Parameters

    inCoordinates
    The set of coordinates to be transformed.
    projectionTransformation
    The projection transformation specifying the input and output spatial references and possibly the geographic transformations to use for the transformation.
    outCoordinates
    The set of transformed coordinates. If it is null or the length is less than the length of inCoordinates, then a new array will be allocated.
    removeClippedCoordinates
    (Optional) The boolean value specifying whether to remove clipped coordinates or not. If true, the coordinates outside of the horizon will be removed from the output array, and the number of initialized elements in the output array is the number of coordinates transformed which may be less than the number of elements in inCoordinates. If false, all coordinates are preserved, the clipped out coordinates are set to NaN in the output array, and the number of elements in the output array is equal to the number of elements in inCoordinates. The default value is true.

    Return Value

    The number of transformed coordinates.
    Exceptions
    ExceptionDescription
    Input parameter, inCoordinates, is null.
    ProjectionTransformation is null.
    Remarks
    This method should be applied to batches of coordinates for fast projection.

    Unlike GeometryEngine.Transform2D there is no option to preserve all coordinates. This means that any coordinates outside of the horizone will be removed from the output. The number of initialized elements in the output is the number of coordinates transformed which may be less than the number of elements in inCoordinates.

    Example
    Transform3D
    // Not all of the input points are transformed as some of them are outside of the GCS horizon.
    Coordinate3D[] inCoords3D = new Coordinate3D[]
    {
      new Coordinate3D(-1, -1, 0),
      new Coordinate3D(-2, -5, 1),
      new Coordinate3D(-5, -11, 2),
      new Coordinate3D(-10, -19, 3),
      new Coordinate3D(-17, -29, 4),
      new Coordinate3D(-26, -41, 5),
      new Coordinate3D(-37, -5, 6),
      new Coordinate3D(-50, -21, 7),
      new Coordinate3D(-65, -39, 8),
      new Coordinate3D(-82, -9, 9)
    };
    
    int arraySize = inCoords3D.Length;
    
    ProjectionTransformation projTrans = ProjectionTransformation.Create(SpatialReferences.WGS84, SpatialReferenceBuilder.CreateSpatialReference(24891));
    
    Coordinate3D[] outCoords3D = new Coordinate3D[arraySize];
    
    // transform and choose to remove the clipped coordinates
    int numPointsTransformed = GeometryEngine.Instance.Transform3D(inCoords3D, projTrans, ref outCoords3D);
    
    // numPointsTransformed = 4
    // outCoords2D.Length = 4
    
    // outCoords2D[0] = {5580417.6876455201, 1328841.2376554986, 7}
    // outCoords2D[1] = {3508774.290814558, -568027.23444226268, 8}
    // outCoords2D[2] = {1568096.0886155984, -2343435.4394415971, 9}
    // outCoords2D[3] = {57325.827391741652, 1095146.8917508761, 10}
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also