ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Geometry Namespace / EnvelopeBuilderEx Class / CreateEnvelope Method / CreateEnvelope(EnvelopeBuilderEx,SpatialReference) Method
The builder to create the envelope.
(Optional) The SpatialReference. The default value is null. If the input spatial reference is null, then the spatial reference from the input builder is used.
Example

In This Topic
    CreateEnvelope(EnvelopeBuilderEx,SpatialReference) Method
    In This Topic
    Convenience method to create a new instance of the Envelope class.
    Syntax
    Public Overloads Shared Function CreateEnvelope( _
       ByVal envelopeBuilderEx As EnvelopeBuilderEx, _
       Optional ByVal spatialReference As SpatialReference _
    ) As Envelope

    Parameters

    envelopeBuilderEx
    The builder to create the envelope.
    spatialReference
    (Optional) The SpatialReference. The default value is null. If the input spatial reference is null, then the spatial reference from the input builder is used.
    Exceptions
    ExceptionDescription
    envelopeBuilderEx is null.
    Example
    Create Map Frame and Set Camera
    {
      //Create a map frame and set its camera by zooming to the extent of an existing bookmark.
      var project = Project.Current;
      await QueuedTask.Run(() =>
      {
    
      //Build 2D envelope geometry
      Coordinate2D mf_ll = new Coordinate2D(6.0, 8.5);
      Coordinate2D mf_ur = new Coordinate2D(8.0, 10.5);
      Envelope mf_env = EnvelopeBuilderEx.CreateEnvelope(mf_ll, mf_ur);
    
      //Reference map, create MF and add to layout
      MapProjectItem mapPrjItem = project.GetItems<MapProjectItem>()
                           .FirstOrDefault(item => item.Name.Equals("Map"));
      Map mfMap = mapPrjItem.GetMap();
      Bookmark bookmark = mfMap.GetBookmarks().FirstOrDefault(
                            b => b.Name == "Great Lakes");
    
      MapFrame mfElm = ElementFactory.Instance.CreateMapFrameElement(
                           layout, mf_env, mfMap, "New Map Frame");
    
      //Zoom to bookmark
      mfElm.SetCamera(bookmark);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also