ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / CalculateFullExtent Method
Example

In This Topic
    CalculateFullExtent Method
    In This Topic
    Returns the full extent of the map. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Envelope CalculateFullExtent()
    Public Function CalculateFullExtent() As Envelope

    Return Value

    An extent.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Get Z values from the default ground surface
    {
      var surfaceZResult = await QueuedTask.Run(async () =>
      {
        // Get the center of the map's full extent
        MapPoint mapPoint = map.CalculateFullExtent().Center;
        //Pass any Geometry type to GetZsFromSurfaceAsync
        return await map.GetZsFromSurfaceAsync(mapPoint);
      });
      if (surfaceZResult.Status == SurfaceZsResultStatus.Ok)
      {
        // cast to a mapPoint
        var mapPointZ = surfaceZResult.Geometry as MapPoint;
        var z = mapPointZ.Z;
      }
    }
    Get Z values from a layer
    {
      await QueuedTask.Run(() =>
      {
        TinLayer tinLayer = map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();
        MapPoint mapPoint = map.CalculateFullExtent().Center; //Any Map Point
        Polyline polyline = PolylineBuilderEx.CreatePolyline(mapView.Extent); //Any Polyline
    
        if (tinLayer.CanGetZs())
        {
          // get z value for a mapPoint
          var zResult = tinLayer.GetZs(mapPoint);
          if (zResult.Status == SurfaceZsResultStatus.Ok)
          {
            // cast to a mapPoint
            var mapPointZ = zResult.Geometry as MapPoint;
            var z = mapPointZ.Z;
          }
    
          // get z values for a polyline
          zResult = tinLayer.GetZs(polyline);
          if (zResult.Status == SurfaceZsResultStatus.Ok)
          {
            // cast to a mapPoint
            var polylineZ = zResult.Geometry as Polyline;
          }
        }
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also