ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / SetLocationUnitFormat Method
The location unit format to set
Example

In This Topic
    SetLocationUnitFormat Method
    In This Topic
    Sets the current map location unit format for the current project. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetLocationUnitFormat( 
       DisplayUnitFormat unitFormat
    )
    Public Sub SetLocationUnitFormat( _
       ByVal unitFormat As DisplayUnitFormat _
    ) 

    Parameters

    unitFormat
    The location 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 location unit formats
    Remarks
    Map location unit formats are used to format the coordinate system display at the bottom of the map or scene as well as format the scale combo box.
    Display units
    . Unit format must be of type ArcGIS.Desktop.Core.UnitFormats.UnitFormatType.Location or a System.ArgumentException will be thrown.
    The location unit format must be in the list of available location unit formats for the map or a System.ArgumentException will be thrown. Refer to: GetAvailableLocationUnitFormats. Note: If the map is using a GCS, linear unit formats are not included (in the list of available units)
    .
    Example
    Set the Location Unit for the Current Map
    var mv = MapView.Active;
    var map = mv.Map;
    
    QueuedTask.Run(() =>
    {
      //Get the list of available location unit formats
      //for the current map
      var loc_units = map.GetAvailableLocationUnitFormats();
    
      //arbitrarily use the last unit in the list
      map.SetLocationUnitFormat(loc_units.Last());
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also