ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / GetAvailableLocationUnitFormats Method
Example

In This Topic
    GetAvailableLocationUnitFormats Method
    In This Topic
    Gets the list of available map location unit formats for the given map. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IList<DisplayUnitFormat> GetAvailableLocationUnitFormats()
    Public Function GetAvailableLocationUnitFormats() As IList(Of DisplayUnitFormat)

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Linear location unit formats are not included in the list of available unit formats if the map spatial reference uses a geographic coordinate system.
    Example
    Get the Available List of Map Location Units
    //var map = MapView.Active.Map;
    //Must be on the QueuedTask.Run()
    
    //Linear location unit formats are not included if the map sr
    //is geographic.
    var loc_units = map.GetAvailableLocationUnitFormats();
    
    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