ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / LinearUnit Class / CreateLinearUnit Method / CreateLinearUnit(String,Double) Method
Name for the linear unit.
Conversion factor. Meters per unit.
Example

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

    Parameters

    name
    Name for the linear unit.
    conversionFactor
    Conversion factor. Meters per unit.

    Return Value

    Example
    LinearUnit - Create a Custom LinearUnit
    // create a custom linear unit - there are 0.33 meters per myLinearUnit
    var myLinearUnit = LinearUnit.CreateLinearUnit("myCustomLinearUnit", 0.33);
    string name = myLinearUnit.Name;                          // myCustomLinearUnit
    double convFactor = myLinearUnit.ConversionFactor;        // 0.33
    int code = myLinearUnit.FactoryCode;                      // 0 for custom units
    double metersUnit = myLinearUnit.MetersPerUnit;           // 0.33
    string toString = myLinearUnit.ToString();                // same as Name - myCustomLinearUnit
    
    // convert 10 centimeters to myLinearUnit 
    double convertedVal = LinearUnit.Centimeters.ConvertTo(10, myLinearUnit);
    
    
    // get the wkt
    string lu_wkt = myLinearUnit.Wkt;
    
    // create an angular unit from this wkt
    var anotherLinearUnit = LinearUnit.CreateLinearUnit(lu_wkt);
    // anotherLinearUnit.ConversionFactor = 0.33
    // anotherLinearUnit.FactoryCode = 0    
    // anotherLinearUnit.MetersPerUnit = 0.33
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also