ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / AreaUnit Class / CreateAreaUnit Method / CreateAreaUnit(String,Double) Method
Name for the area unit
Conversion factor. Square meters per unit
Example

In This Topic
    CreateAreaUnit(String,Double) Method
    In This Topic
    Convenience method to quickly create a custom AreaUnit instance.
    Syntax
    Public Overloads Shared Function CreateAreaUnit( _
       ByVal name As String, _
       ByVal conversionFactor As Double _
    ) As AreaUnit
    public static AreaUnit CreateAreaUnit( 
       string name,
       double conversionFactor
    )

    Parameters

    name
    Name for the area unit
    conversionFactor
    Conversion factor. Square meters per unit

    Return Value

    Example
    AreaUnit - Create an AreaUnit
    {
      try
      {
        var myFactoryCodeInit = AreaUnit.CreateAreaUnit(109439);     // 109439 is the factory code for square miles
    
        var myWktUnit = AreaUnit.CreateAreaUnit("HECTARE_AREAUNIT[\"H\",10000.0]");
    
        var myCustomUnit = AreaUnit.CreateAreaUnit("myAreaUnit", 12);
      }
      catch (ArgumentException)
      {
        // ArgumentException will be thrown by CreateAreaUnit in the following scenarios
        // - if the factory code used is a non-areal factory code  (i.e. it corresponds to degrees which is an angular 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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also