ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Geometry Namespace / EnvelopeBuilderEx Class / CreateEnvelope Method / CreateEnvelope(Envelope,SpatialReference) Method
The Envelope that will be copied.
(Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference is inherited from envelope.
Example

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

    Parameters

    envelope
    The Envelope that will be copied.
    spatialReference
    (Optional) The SpatialReference. The default value is null. If spatialReference is null, then the spatial reference is inherited from envelope.

    Return Value

    Exceptions
    ExceptionDescription
    envelope is null.
    Remarks
    The resulting envelope inherits attributes, Z, M and ID-values, from the input envelope.
    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