ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Expand Method / Expand(Envelope,Double,Double,Boolean) Method
The envelope to expand or shrink.
The scale factor along the X-axis. In other words, the amount to expand or shrink the width of the envelope.
The scale factor along the Y-axis. In other words, the amount to expand or shrink the height of the envelope.
If asRatio = false, the expansion is additive. If asRatio = true, the expansion is multiplicative.
Example

In This Topic
    Expand(Envelope,Double,Double,Boolean) Method
    In This Topic
    Expands or shrinks the envelope.
    Syntax
    Public Overloads Function Expand( _
       ByVal envelope As Envelope, _
       ByVal dx As Double, _
       ByVal dy As Double, _
       ByVal asRatio As Boolean _
    ) As Envelope

    Parameters

    envelope
    The envelope to expand or shrink.
    dx
    The scale factor along the X-axis. In other words, the amount to expand or shrink the width of the envelope.
    dy
    The scale factor along the Y-axis. In other words, the amount to expand or shrink the height of the envelope.
    asRatio
    If asRatio = false, the expansion is additive. If asRatio = true, the expansion is multiplicative.

    Return Value

    The scaled envelope.
    Exceptions
    ExceptionDescription
    Envelope is null or empty.
    Remarks
    If asRatio is set to true, dx and dy must be greater than or equal to zero. In this case, if the user wants to increase the envelope width by 10%, then dx = 1.1. On the other hand, if the user wants to decrease the width by 10%, then dx = 0.9.
    Example
    Expand envelopes
    {
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(100.0, 100.0, 500.0, 500.0);
      // env.HasZ = false
    
      Envelope result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, true);
      // result.Center = 300, 300
      // result.XMin = 200
      // result.YMin = 200
      // result.XMax = 400
      // result.YMax = 400
    
      result = GeometryEngine.Instance.Expand(env, 100, 200, false);
      // result.Center = 300, 300
      // result.XMin = 0
      // result.YMin = -100
      // result.XMax = 600
      // result.YMax = 700
    
      try
      {
        // expand in 3 dimensions
        result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);
      }
      catch (InvalidOperationException)
      {
        // the geometry is not Z-Aware
      }
    
      // expand a 3d envelope
      MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(100, 100, 100);
      MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(200, 200, 200);
    
      env = EnvelopeBuilderEx.CreateEnvelope(pt1, pt2);
      // env.HasZ = true
    
      result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);
    
      // result.Center = 150, 150, 150
      // result.XMin = 125
      // result.YMin = 125
      // result.ZMin = 125
      // result.XMax = 175
      // result.YMax = 175
      // result.ZMax = 175
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also