ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Geometry Namespace / EnvelopeBuilderEx Class / CreateEnvelope Method / CreateEnvelope(SpatialReference) Method
(Optional) The SpatialReference. The default value is null.
Example

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

    Parameters

    spatialReference
    (Optional) The SpatialReference. The default value is null.

    Return Value

    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