ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / CenterAt Method
The envelope to center.
X-coordinate of the center.
Y-coordinate of the center.
Example

In This Topic
    CenterAt Method (GeometryEngine)
    In This Topic
    Center the envelope at the specified X and Y coordinates.
    Syntax
    public Envelope CenterAt( 
       Envelope envelope,
       double x,
       double y
    )
    Public Function CenterAt( _
       ByVal envelope As Envelope, _
       ByVal x As Double, _
       ByVal y As Double _
    ) As Envelope

    Parameters

    envelope
    The envelope to center.
    x
    X-coordinate of the center.
    y
    Y-coordinate of the center.

    Return Value

    The envelope centered at the X and Y coordinates.
    Exceptions
    ExceptionDescription
    Envelope is null or empty.
    Example
    Center an envelope around X,Y
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(1.0, 1.0, 5.0, 5.0);
    Envelope centered = GeometryEngine.Instance.CenterAt(env, 2.0, 2.0);
    
    // centered.Center.X = 2.0
    // centered.Center.Y = 2.0
    // centered.XMin = 0
    // centered.YMin = 0
    // centered.XMax = 4
    // centered.YMax = 4
    
    centered = env.CenterAt(4.0, 3.0);
    // centered.Center.X == 4.0
    // centered.Center.Y == 3.0
    // centered.XMin == 2.0
    // centered.YMin == 1.0
    // centered.XMax == 6.0
    // centered.YMax == 5.0
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also