ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Camera Class / Heading Property
Example

In This Topic
    Heading Property (Camera)
    In This Topic
    Gets or sets the Heading of the Camera, in degrees from North. 0 is North, 90 is West, 180 is South, -90 is East, etc. This property applies to both 2D and 3D views.
    Syntax
    public double Heading {get; set;}
    Public Property Heading As Double
    Remarks

    Heading, Pitch and Roll are used to describe the viewing direction in a 3D view. Sometimes referred to as Yaw, Heading defines the angle of the camera rotating around the Z-axis. Imagine yourself as the camera. In this case adjusting the heading would be equivalent to looking to the left or right. The valid range for heading is -180 to 180 which are equal looking south. A value of 0 is looking north.

    Heading is the one viewing direction property that is also used in 2D view. In a 2D view Heading determines and will determine the rotation of the view.

    Example
    Rotate the map view
    public Task<bool> RotateView(double heading)
    {
      //Get the active map view.
      var mapView = MapView.Active;
      if (mapView == null)
        return Task.FromResult(false);
    
      //Get the camera for the view, adjust the heading and zoom to the new camera position.
      var camera = mapView.Camera;
      camera.Heading = heading;
      return mapView.ZoomToAsync(camera, TimeSpan.Zero);
    }
    
    // or use the synchronous method
    public Task<bool> RotateViewAsync(double heading)
    {
      return QueuedTask.Run(() =>
      {
        //Get the active map view.
        var mapView = MapView.Active;
        if (mapView == null)
          return false;
    
        //Get the camera for the view, adjust the heading and zoom to the new camera position.
        var camera = mapView.Camera;
        camera.Heading = heading;
        return mapView.ZoomTo(camera, TimeSpan.Zero);
      });
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also