ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / SetElevationUnitFormat Method
The elevation unit format to set
Example

In This Topic
    SetElevationUnitFormat Method
    In This Topic
    Sets the current scene elevation unit format. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetElevationUnitFormat( 
       DisplayUnitFormat unitFormat
    )
    Public Sub SetElevationUnitFormat( _
       ByVal unitFormat As DisplayUnitFormat _
    ) 

    Parameters

    unitFormat
    The elevation unit format to set
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    unit format is of the wrong type
    unit format is not in the list of available elevation unit formats
    elevation unit format can only be set on a scene
    Remarks
    Calling SetElevationUnitFormat on anything other than a scene will result in a System.InvalidOperationException.
    Elevation unit format must be of type ArcGIS.Desktop.Core.UnitFormats.UnitFormatType.Distance or a System.ArgumentException will be thrown.
    The elevation unit format must be in the list of available distance unit formats for the project - ArcGIS.Desktop.Core.UnitFormats.DisplayUnitFormats.GetProjectUnitFormats or a System.ArgumentException will be thrown.
    . The elevation unit format is used to format the units used by the coordinate system display at the bottom of the scene that shows elevation as well as format the scale combo box.
    unitFormat must be in the list of available elevation unit formats or a System.ArgumentException is thrown. Refer to: GetAvailableElevationUnitFormats.
    Example
    Set the Elevation Unit for the Current Map
    var map = MapView.Active.Map;
    
    QueuedTask.Run(() =>
    {
      //Trying to set the elevation unit on a map other than
      //a scene will throw an InvalidOperationException
      if (map.IsScene)
      {
        //Get the list of available elevation unit formats
        //for the current map
        var loc_units = map.GetAvailableElevationUnitFormats();
        //arbitrarily use the last unit in the list
        map.SetElevationUnitFormat(loc_units.Last());
      }
    
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also