ArcGIS Pro 2.9 API Reference Guide
ReplaceSpatialReference Method

ArcGIS.Core.Geometry Namespace > GeometryBuilderEx Class : ReplaceSpatialReference Method
The source geometry that needs a new spatial reference.
New spatial reference to set.
Replaces SpatialReference of the input Geometry instance.
Syntax
public static Geometry ReplaceSpatialReference( 
   Geometry sourceGeometry,
   SpatialReference newSpatialReference
)
Public Shared Function ReplaceSpatialReference( _
   ByVal sourceGeometry As Geometry, _
   ByVal newSpatialReference As SpatialReference _
) As Geometry

Parameters

sourceGeometry
The source geometry that needs a new spatial reference.
newSpatialReference
New spatial reference to set.

Return Value

Returns new Geometry instance if sourceGeometry.SpatialReference != newSpatialReference The method returns sourceGeometry if the newSpatialReference == sourceGeometry.SpatialReference.
Exceptions
ExceptionDescription
The geometry is null.
The geometry is the wrong type.
Remarks
The method only supports Geometry types that have corresponding GeometryBuilderEx implemented.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

GeometryBuilderEx Class
GeometryBuilderEx Members