ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / AngularUnit Class / CreateAngularUnit Method / CreateAngularUnit(Int32) Method
The angular unit factory code.
Example

In This Topic
    CreateAngularUnit(Int32) Method
    In This Topic
    Convenience method to quickly create a AngularUnit instance using a factory code.
    Syntax
    public static AngularUnit CreateAngularUnit( 
       int factoryCode
    )
    Public Overloads Shared Function CreateAngularUnit( _
       ByVal factoryCode As Integer _
    ) As AngularUnit

    Parameters

    factoryCode
    The angular unit factory code.

    Return Value

    Exceptions
    ExceptionDescription
    The factoryCode is not a valid angular unit code.
    Remarks

    The available angular units of measure.

    Factory Code Unit Name
    9101 Radian
    9102 Degree
    9103 Arc-minute
    9104 Arc-second
    9105 Grad
    9106 Gon
    9109 Microradian
    9112 Centesimal arc-minute
    9113 Centesimal arc-second
    9114 Mil
    909003 DD (Decimal Degree)
    909004 DMS (Degree Minute Second)
    909005 DDM (Degree Decimal Minute)

    Example
    AngularUnit - Create an AngularUnit with a factory code
    try
    {
      // create a Grad unit
      var grad = AngularUnit.CreateAngularUnit(9105);
      string unitName = grad.Name;                        // Grad
      double conversionFactor = grad.ConversionFactor;    // 0.015708
      double radiansPerUnit = grad.RadiansPerUnit;
      int factoryCode = grad.FactoryCode;                 // 9105
    
      // convert 10 grads to degrees
      double val = grad.ConvertTo(10, AngularUnit.Degrees);
    
      // convert 10 radians to grads
      val = grad.ConvertFromRadians(10);
    }
    catch (ArgumentException)
    {
      // ArgumentException will be thrown by CreateAngularUnit in
      // the following scenarios:
      // - if the factory code used is a non-angular factory code
      //   (i.e. it corresponds to square meters which is an area unit code)
      // - if the factory code used is invalid
      //   (i.e. it is negative or doesn't correspond to any factory code)
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also